Integrated: 8339190: Parameter arrays that are capped during annotation processing report incorrect length

Nizar Benalla nbenalla at openjdk.org
Thu Nov 7 10:32:52 UTC 2024


On Wed, 23 Oct 2024 11:45:15 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:

> Can I please get reviews for this change.
> 
> The regression test creates temporary files in `tmpdir` to check that the warning is emitted correctly.
> I've also added the new warning to `example.not-yet.txt` as the example would require a very large file.
> 
> Here is the truncated result of running `javap -c -p -v` (before the change) on `ClassAnnotationWithLength_65536_RUNTIME.class`  and `ClassAnnotationWithLength_65537_RUNTIME..class` respectively.
> 
> 
>   static int x;
>     descriptor: I
>     flags: (0x0008) ACC_STATIC
>     RuntimeVisibleAnnotations:
>       0: #14(#15=s#16,#17=I#18,#19=[])
>         MyCustomAnno(
>           value="custom"
>           count=42
>           arr=[]
>         )
> 
> 
>   static int x;
>     descriptor: I
>     flags: (0x0008) ACC_STATIC
>     RuntimeVisibleAnnotations:
>       0: #14(#15=s#16,#17=I#18,#19=[J#20])
>         MyCustomAnno(
>           value="custom"
>           count=42
>           arr=[-1l]
>         )
> 
> 
> After the change a compile-time error is thrown
> 
> 
> javac ClassAnnotationWithLength_65536_RUNTIME.java 
> error: Annotation array element too large in "MyCustomAnno"
> 
> 
> TIA

This pull request has now been integrated.

Changeset: 42446823
Author:    Nizar Benalla <nbenalla at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/4244682309e7ae1be892280dfd6a6f70ccecc760
Stats:     165 lines in 5 files changed: 165 ins; 0 del; 0 mod

8339190: Parameter arrays that are capped during annotation processing report incorrect length

Reviewed-by: vromero

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

PR: https://git.openjdk.org/jdk/pull/21663


More information about the compiler-dev mailing list