RFR: 8339190: Parameter arrays that are capped during annotation processing report incorrect length [v2]
Chen Liang
liach at openjdk.org
Thu Oct 24 13:03:10 UTC 2024
On Thu, 24 Oct 2024 12:47:19 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:
>> 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`
If you use `& ~0xFFFF` you must use `!= 0` as the mask includes the sign bit.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21663#discussion_r1814938704
More information about the compiler-dev
mailing list