On Fri, 17 Apr 2026 12:59:03 GMT, Alexey Ivanov <[email protected]> wrote:
>> Phil Race has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> 8377568
>
> src/java.desktop/share/classes/java/awt/image/DataBufferByte.java line 95:
>
>> 93: * or {@code numBanks} is less than one.
>> 94: */
>> 95: public DataBufferByte(int size, int numBanks) {
>
> Should this type of constructors specify `NegativeArraySizeException`? It's
> thrown if I pass a negative number in `numBank`.
Looks like I don't have a test for that. I will add it.
It would be bizarre to throw NASE for -1 but IAE for 0, and often NASE is an
indicator that something overflowed, which is a bad look. So more reason to be
consistent.
However to intercept this means I do need to move some checks to the
super-class.
So I guess you get that wish :-)
But I still need to keep the throws clauses on all the sub-classes which
separates the actual checking from the text. That isn't ideal IMO but, it would
otherwise mean duplicating the checks which also isn't great
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29766#discussion_r3102502544