RFR: 8315447: Invalid Type Annotation attached to a method instead of a lambda

Chen Liang liach at openjdk.org
Tue Mar 25 19:04:16 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.

Thanks for the reviews!

-------------

PR Comment: https://git.openjdk.org/jdk/pull/24206#issuecomment-2752248926


More information about the compiler-dev mailing list