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:39 UTC 2022
On Tue, 19 Jul 2022 15:25:06 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> modules/javafx.controls/src/test/java/test/javafx/scene/control/TreeViewTest.java line 3077:
>>
>>> 3075: @Override public boolean equals(Object obj) {
>>> 3076: if (obj == null) return false;
>>> 3077: return id == ((RT22599_DataType)obj).id;
>>
>> Same as `ListViewTest`.
>
> this and ListViewTest - the logic in hashCode() follows the logic in equals().
> it is fairly safe change, as these objects are never put into a hashtable and never accessed outside of the test context.
Yes.
>> modules/javafx.fxml/src/main/java/javafx/fxml/FXMLLoader.java line 2322:
>>
>>> 2320: }
>>> 2321: return false;
>>> 2322: }
>>
>> Same as `ListViewTest`.
>
> in the case of FXMLoader, hashCode() also follows the logic of equals().
> However, we could mix something specific to FXMLoader to the hash, to avoid collision with origin URL.
I think this is fine as you now have it. If anyone feels it is worth it, we could file a follow-on issue to look into whether `equals` should be changed, but I don't know whether it is worth it.
-------------
PR: https://git.openjdk.org/jfx/pull/821
More information about the openjfx-dev
mailing list