-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add hashCode and equals to UniformGranularitySpec #1824
Conversation
@@ -62,7 +62,7 @@ public boolean equals(Object o) | |||
@Override | |||
public int hashCode() | |||
{ | |||
return 0; | |||
return getClass().hashCode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why this is necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise All and None have a hash collision. Minor detail, and I can take it out if people are worried about the impact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, then we can just make it 0 for none and 1 for all, if collisions are a problem. Seems unnecessary to use class name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to -1, and 1 as per conversation on slack
* Also add hashCode != 0 to AllGranularity and NoneGranularity
ce9ca54
to
f432b8e
Compare
LGTM |
👍 |
Add hashCode and equals to UniformGranularitySpec
This was causing some problems in unit tests in some libraries I'm developing.