Fix Parameter Runtime*ParameterAnnotations spec

Remi Forax forax at
Tue Oct 31 08:47:50 UTC 2017

[I've trouble to find what is the right list for the JVMS spec change describe below, so i apologize in advance for the spam]

Hi all,
the spec of the Runtime*ParameterAnnotations attribute [1], allow the number of parameter annotations to be different from the number of parameter from the method descriptor but it fails to provide a way to retrieve/compute the mapping between a parameter and a parameter annotation.

So people try to guess and fail, here is by example the ASM bug when we tried to provide such mapping to our user [2].

We (the ASM team) believe the only way to fix that is to require that if the number of parameters from the descriptor and the number of parameter annotations doesn't match then compilers should also emit a Parameter attribute which already indicate if a parameter is synthetic or not.

The Parameter attribute is not emitted by default by compilers because it will make the class files too fat, here we are proposing to only emit the Parameter attribute in the case where there are annotations on parameters and the method has synthetic parameters, so it should not be a problem.



More information about the amber-spec-experts mailing list