On Tue, 9 Jun 2026 14:25:16 GMT, Frederic Parain <[email protected]> wrote:
>> src/java.base/share/classes/jdk/internal/value/ValueClass.java line 93:
>>
>>> 91: }
>>> 92: if (length < 0) {
>>> 93: throw new IllegalArgumentException("Array length is
>>> negative");
>>
>> There is an exact exception for this (also thrown by
>> [`java.lang.reflect.Array::newInstance`]):
>> Suggestion:
>>
>> throw new NegativeArraySizeException(Integer.toString(length));
>>
>>
>> [`java.lang.reflect.Array::newInstance`]:
>> https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/lang/reflect/Array.html#newInstance(java.lang.Class,int)
>
> Thank you for spotting this issue. The exception has been fixed as well as
> the related tests.
I suggested to use `Integer::toString` to match the current exception message
thrown by the `newarray`, `anewarray`, and `multianewarray` opcodes; and the
`java.lang.reflect.Array::newInstance` methods.
-------------
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2435#discussion_r3383001473