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

Enancement request: "HE: Use of class without a hashCode() method in a hashed data structure" #969

Open
ajamato opened this issue Jun 14, 2019 · 1 comment

Comments

@ajamato
Copy link

ajamato commented Jun 14, 2019

Hi, I noticed that this bug will only trigger for objects which define an equals() but not hashcode(). But there is a similar class, where a class defines neither, which is a potential bug as well. The user may intend for two "equal" objects to hash to the same value, but the actual equals() and hashCode() implementations come from the base Object class. So only the object reference address will be used in equality, nothing particular about the object instances themselves.

HE: Use of class without a hashCode() method in a hashed data structure

A class defines an equals(Object) method but not a hashCode() method, and thus doesn't fulfill the requirement that equal objects have equal hashCodes. An instance of this class is used in a hash data structure, making the need to fix this problem of highest importance.

@welcome
Copy link

welcome bot commented Jun 14, 2019

Thanks for opening your first issue here! 😃
Please check our contributing guideline. Especially when you report a problem, make sure you share a Minimal, Complete, and Verifiable example to reproduce it in this issue.

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