You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2020/05/28 00:55:09 UTC

[GitHub] [groovy] awallgren edited a comment on pull request #1260: GROOVY-9575 ASTNode.hashCode violates Object.hashCode contract: does not return consistent value

awallgren edited a comment on pull request #1260:
URL: https://github.com/apache/groovy/pull/1260#issuecomment-635025088


   > https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#hashCode()
   > 
   > > Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. **This integer need not remain consistent from one execution of an application to another execution of the same application.**
   > 
   > As the javadoc of `hashCode` shows, "This integer need not remain consistent from one execution of an application to another execution of the same application."
   
   I believe you are misreading that.  It doesn't need to be consistent between invocations of the JVM itself (i.e. between different processes). 
   
   It should return the same value as long as no properties referenced in equals() change while invoked against the same object for the lifetime of the JVM process in which it was created.
   


----------------------------------------------------------------
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:
users@infra.apache.org