RFR: 8289389: Fix warnings: type should also implement hashCode() since it overrides Object.equals() [v3]
Kevin Rushforth
kcr at openjdk.org
Fri Jul 22 16:30:36 UTC 2022
On Tue, 19 Jul 2022 03:43:51 GMT, Nir Lisker <nlisker at openjdk.org> wrote:
>> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8289389: minimize the impact of collision
>
> modules/javafx.controls/src/test/java/test/javafx/scene/control/ListViewTest.java line 1715:
>
>> 1713: @Override public boolean equals(Object obj) {
>> 1714: if (obj == null) return false;
>> 1715: return id == ((RT22599_DataType)obj).id;
>
> I note that the `equals` method here is wrong. The `hashCode` implementation is fine.
This does look dubious. Since this was written for a specific unit test, it might have been intentional to have a "wrong" equals method, but if so, a comment should have been added to that effect. In any case, fixing `equals` is out of scope for this PR. And given what `equals` does, the proposed `hashCode` method is correct.
-------------
PR: https://git.openjdk.org/jfx/pull/821
More information about the openjfx-dev
mailing list