Integrated: 8315447: Invalid Type Annotation attached to a method instead of a lambda
Chen Liang
liach at openjdk.org
Tue Mar 25 19:04:17 UTC 2025
On Mon, 24 Mar 2025 20:13:42 GMT, Chen Liang <liach at openjdk.org> wrote:
> 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.
This pull request has now been integrated.
Changeset: f5a0db43
Author: Chen Liang <liach at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/f5a0db43b76ea58f54d87c49d97c7d87ee1b4ba6
Stats: 238 lines in 3 files changed: 89 ins; 138 del; 11 mod
8315447: Invalid Type Annotation attached to a method instead of a lambda
Reviewed-by: vromero
-------------
PR: https://git.openjdk.org/jdk/pull/24206
More information about the compiler-dev
mailing list