RFR: 8315447: Invalid Type Annotation attached to a method instead of a lambda
Chen Liang
liach at openjdk.org
Mon Mar 24 20:18:46 UTC 2025
In `LambdaToMethod`, when a type annotation is attributed to a lambda's synthetic method or the original method, the annotation's position is queried. However, for container annotations, their positions may not yet be up-to-date, and they are wrongly attributed to the outer method.
This bug was discovered because this wrong attribution can bring in an invalid BCI value referring to a lambda method code array that may be out-of-bounds for the outer method. CombinationTargetTest3 had to stay on the old internal proprietary classfile API due to this reason, as the ClassFile API throws an IAE for such a malformed type annotation attribute.
Please review this patch; this is a blocker for the removal of com.sun.tools.classfile from the JDK, which I wish to accomplish when the boot JDK is 24.
Testing: langtools/tools/javac and javap.
-------------
Commit messages:
- 8315447: Invalid Type Annotation attached to a method instead of a lambda
Changes: https://git.openjdk.org/jdk/pull/24206/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24206&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8315447
Stats: 238 lines in 3 files changed: 89 ins; 138 del; 11 mod
Patch: https://git.openjdk.org/jdk/pull/24206.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24206/head:pull/24206
PR: https://git.openjdk.org/jdk/pull/24206
More information about the compiler-dev
mailing list