Integrated: 8334870: javac does not accept classfiles with certain permitted RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations attributes
Jan Lahoda
jlahoda at openjdk.org
Tue Sep 10 06:16:16 UTC 2024
On Mon, 24 Jun 2024 15:06:01 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> JVMS 4.7.18 and 4.7.19 say this about the entries in the RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations attributes:
>
>> 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).
>
> When reading classfiles, javac does not follow this specification (which puts no requirements on the number of entries in the attributes), but rather expects as many entries as the `MethodSymbol.type` has (which is either based in the `Signature` attribute, if present, or the method descritor, if `Signature` is not present).
>
> This patch proposes to adjust javac to accept the attributes with any number of entries, implementing a number of heuristics to map the content of the entries in the attributes to the parameters. There are comments in the code explaining the heuristics.
>
> javac will ignore the RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations attributes it cannot handle with a warning.
This pull request has now been integrated.
Changeset: 5e822c24
Author: Jan Lahoda <jlahoda at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/5e822c24bb42e9027c8d9090d498bca7125d1963
Stats: 1246 lines in 6 files changed: 856 ins; 382 del; 8 mod
8334870: javac does not accept classfiles with certain permitted RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations attributes
Reviewed-by: vromero
-------------
PR: https://git.openjdk.org/jdk/pull/19860
More information about the compiler-dev
mailing list