gianm commented on a change in pull request #8381: Fix inconsistent equals and
hashCode
URL: https://github.com/apache/incubator-druid/pull/8381#discussion_r317022126
##########
File path:
processing/src/main/java/org/apache/druid/query/extraction/IdentityExtractionFn.java
##########
@@ -82,6 +82,12 @@ public boolean equals(Object o)
return o != null && o instanceof IdentityExtractionFn;
}
+ @Override
+ public int hashCode()
+ {
+ return super.hashCode();
Review comment:
This isn't correct; it defers to the default implementation of
`Object::hashCode`, which will be different for different instances, but the
contract of `hashCode` requires that two objects' hash codes be the same if
`equals` is true.
It would be better to return a constant.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]