RFR: 8339190: Parameter arrays that are capped during annotation processing report incorrect length [v3]
Nizar Benalla
nbenalla at openjdk.org
Thu Nov 7 10:32:51 UTC 2024
On Thu, 31 Oct 2024 18:02:56 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
>
> Nizar Benalla 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 seven additional commits since the last revision:
>
> - Update test
> - revert changes to TypeAnnotations
> generate error when param array is too large
> generate error closer to other limits, during code gen
> - Merge remote-tracking branch 'upstream/master' into 8339190-Parameter-arrays
> - - remove unused import
> - realized I need to change the condition in my for loop
> - try to remove trailing whitespace
> - simplify BufferedWriter creation
> - JDK-8339190
Passes tier 1-3, thanks all for the reviews on this. Here goes
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21663#issuecomment-2461868208
More information about the compiler-dev
mailing list