Remove the workaround introduced for synthetic parameters.
A workaround was added in 4accca37 for issue #307392. The root cause of the bug was that, via a ClassReader->ClassWriter transform, the number of parameter annotations was not preserved (the number read in ClassReader was ignored, and it was recomputed from the descriptor in MethodWriter). The workaround added at this time was fixing that, and it was also attempting to report parameter indices corresponding to the source parameters, assuming that the implicit parameters were at added at the begining. However, synthetic parameters can also be added at the end (see issue #317788), so the second part of the above workaround does not work. This change removes this workaround, and replaces it with a method to preserve the num_parameters value read in ClassReader (via a sentinel annotation). In other words, this change still fixes the root cause of #307392, but no longer attempts to map bytecode parameter indices to source level parameter indices. We believe there is no universal method for doing that, but users can implement their own method, if desired, on top of the ASM API. Indeed, the JVMS spec states that (https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18): BEGIN QUOTE The i'th entry in the parameter_annotations table may, but is not required to, correspond to the i'th parameter descriptor in the method descriptor (§4.3.3). For example, a compiler may choose to create entries in the table corresponding only to those parameter descriptors which represent explicitly declared parameters in source code. In the Java programming language, a constructor of an inner class is specified to have an implicitly declared parameter before its explicitly declared parameters (JLS §8.8.1), so the corresponding <init> method in a class file has a parameter descriptor representing the implicitly declared parameter before any parameter descriptors representing explicitly declared parameters. If the first explicitly declared parameter is annotated in source code, then a compiler may create parameter_annotations to store annotations corresponding to the second parameter descriptor. END QUOTE
Showing with 26 additions and 32 deletions