Fix Parameter Runtime*ParameterAnnotations spec
Remi Forax
forax at univ-mlv.fr
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.
regards,
Rémi
[1] https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18
[2] https://gitlab.ow2.org/asm/asm/issues/317788
More information about the valhalla-spec-observers
mailing list