[OpenJDK 2D-Dev] RFR: 8263981: java.awt.image.ComponentSampleModel equals/hashcode use numBands twice

Sergey Bylokhov serb at openjdk.java.net
Mon Mar 22 18:04:42 UTC 2021


On Mon, 22 Mar 2021 17:48:21 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> src/java.desktop/share/classes/java/awt/image/ComponentSampleModel.java line 1228:
>> 
>>> 1226:         }
>>> 1227:         hash ^= numBands;
>>> 1228:         hash <<= 8;
>> 
>> Since this mistake was done in two places I think this is a typo here and not an intentional thing.
>
> I am a bit confused by this comment :) I suspect that `equals` got duplicated `numBands` first, and then whoever did the `hashcode` just hashed the same fields in the same order, duplicating it again.

I hope so, and not in the opposite order. I'll try to check the history f this file.

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

PR: https://git.openjdk.java.net/jdk/pull/3125


More information about the 2d-dev mailing list