RFR: 8339190: Parameter arrays that are capped during annotation processing report incorrect length [v2]

Nizar Benalla nbenalla at openjdk.org
Thu Oct 24 12:50:07 UTC 2024


On Thu, 24 Oct 2024 04:22:50 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Nizar Benalla has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   - remove unused import
>>   - realized I need to change the condition in my for loop
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java line 1430:
> 
>> 1428:         private void checkArraySize(List<JCExpression> tree) {
>> 1429:             //check if attribute length exceeds maximum unsigned 16-bit value
>> 1430:             if (!sigOnly && tree != null && (tree.size() >>> 16) > 0) {
> 
> Should we use `(tree.size & ~0xFFFF) != 0`? This is how classfile API checks the value compatibility, and I wonder how other places in javac does so.

I was trying to chose between this and `tree.size & ~0xFFFF`, I think `javac` will sometimes check if an int is larger than `0xFFFF`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21663#discussion_r1814913041


More information about the compiler-dev mailing list