On Tue, 3 Mar 2026 22:46:07 GMT, Phil Race <[email protected]> wrote:

>> src/java.desktop/share/classes/java/awt/image/DataBufferByte.java line 79:
>> 
>>> 77:     public DataBufferByte(int size) {
>>> 78:         super(STABLE, TYPE_BYTE, size);
>>> 79:         checkSize(size);
>> 
>> Why not move the call to `checkSize` into the superclass constructor of 
>> `DataBuffer`?
>> 
>> Any data buffer of `size <= 0` doesn't make sense, then you won't have to 
>> call `checkSize` explicitly in all the classes.
>
> Same reason as above. So I want it here.

Possibly discussed before, but I missed why we do not want to update DataBuffer 
instead, to ensure any subclasses are validated? Not only specific for this 
constructor but for all methods in that parent class.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/29766#discussion_r2984447511

Reply via email to