RFR: 8289389: Fix warnings: type should also implement hashCode() since it overrides Object.equals() [v4]

Andy Goryachev angorya at openjdk.org
Thu Jul 21 18:32:21 UTC 2022


On Tue, 19 Jul 2022 15:48:09 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> - added missing hashCode() methods
>
> Andy Goryachev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - 8289389: review comments
>  - Merge remote-tracking branch 'origin/master' into 8289389.hash
>  - 8289389: minimize the impact of collision
>  - 8289389: toExternalForm()
>  - 8289389: implemented missing hashCode()

John:

You do bring a good point, I am sure someone have tripped this trap by adding a mutable object to a hashtable and then mutating it afterwards.  We do have some words of caution in the java.util.Map interface javadoc:

"Note: great care must be exercised if mutable objects are used as map keys..."

At the same time, I feel like this discussion goes beyond the scope of this PR, as it falls under the rubric of design decisions in the client code.

Is there anything specific you think should be changed in this PR, or are you against these code changes in principle?

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

PR: https://git.openjdk.org/jfx/pull/821


More information about the openjfx-dev mailing list