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

Andy Goryachev duke at openjdk.org
Mon Jul 11 22:44:43 UTC 2022


On Mon, 11 Jul 2022 21:12:02 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Ah, I didn't realize you checked how this is optimized by the JIT.
>
> In order to reduce collisions, the hash of each component is typically added to `h * 31` even when that hash is 0, whereas you skip the `h = 31 * h` in the case of null. It might not be a problem in practice, since value and origin are unlikely to collide, being of different types, but you might want to look at it.
> 
> In any case, I need to time to look at it, which I won't have until after JavaFX 19 RDP1, so let's leave this until then.

you bring a good point, Kevin, thank you!

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

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


More information about the openjfx-dev mailing list