On Thu, 14 May 2026 22:20:05 GMT, Sergey Bylokhov <[email protected]> wrote:

>> src/java.desktop/share/classes/java/awt/image/MultiPixelPackedSampleModel.java
>>  line 164:
>> 
>>> 162:         this.dataType = dataType;
>>> 163:         if ((numberOfBits <= 0) || ((numberOfBits & (numberOfBits - 
>>> 1)) != 0)) {
>>> 164:             throw new RasterFormatException("numberOfBits per pixel 
>>> must be a power of 2");
>> 
>> You would have got an exception anyway for these (although 0 would have been 
>> the wrong type).
>> This just makes it clearer that you've passed in an illegal value because it 
>> is not a power of 2, vs spanning a data element.
>
> Why the validation splits in "parts"? It seems "this.dataType = dataType;" 
> should be assigned only if all validation above and below are passed.

I've moved it down.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/30826#discussion_r3251043075

Reply via email to