RFR: 8334870: javac does not accept classfiles with certain permitted RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations attributes [v3]
Jan Lahoda
jlahoda at openjdk.org
Mon Sep 9 13:31:06 UTC 2024
> 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.
Jan Lahoda has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains nine additional commits since the last revision:
- Adjusting test to an updated ClassFile API.
- Merge branch 'master' into JDK-8024694
- Merge branch 'master' into JDK-8024694
- Reflecting review feedback.
- Adding a new bug number.
- Adjusting heuristics.
- Fixing tests.
- Fixing tests.
- 8024694: javac always expects signature attribute for enum constructors
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/19860/files
- new: https://git.openjdk.org/jdk/pull/19860/files/3404a1f0..5d8cafbd
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=19860&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=19860&range=01-02
Stats: 118935 lines in 2906 files changed: 73366 ins; 29285 del; 16284 mod
Patch: https://git.openjdk.org/jdk/pull/19860.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/19860/head:pull/19860
PR: https://git.openjdk.org/jdk/pull/19860
More information about the compiler-dev
mailing list