Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message in ObjectsHashCodeUnnecessaryVarargs should point out that the generated hascode is different #1811

Open
gm2211 opened this issue Jun 23, 2021 · 0 comments

Comments

@gm2211
Copy link
Contributor

gm2211 commented Jun 23, 2021

What happened?

The ObjectsHashCodeUnnecessaryVarargs recommended that I should change Objects.hash to Objects.hashCode.
It did not warn that the hash generated by the two methods can be different for the same object.
If someone has stored those hashes (though one should arguably use Guava's Hashing for persisted hashes), this could cause false mismatches (which in turn could lead to things like cache misses).

What did you want to happen?

The check should warn users that the hashcode generated by Objects.hash and Objects.hashCode can be different and maybe call out explicitly the edge-case of persisted hashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant