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/27 03:24:40 UTC

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

awallgren opened a new pull request #1260:
URL: https://github.com/apache/groovy/pull/1260


   Remove unsuitable ASTNode.hashCode -- it does not conform to the Object
   .hashCode general contract.


----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
awallgren commented 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 needs to return the same value as long as no properties referenced in equals() changes.
   


----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
danielsun1106 commented on pull request #1260:
URL: https://github.com/apache/groovy/pull/1260#issuecomment-635023987


   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."


----------------------------------------------------------------
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



[GitHub] [groovy] danielsun1106 merged pull request #1260: GROOVY-9575 ASTNode.hashCode violates Object.hashCode contract: does not return consistent value

Posted by GitBox <gi...@apache.org>.
danielsun1106 merged pull request #1260:
URL: https://github.com/apache/groovy/pull/1260


   


----------------------------------------------------------------
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



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

Posted by GitBox <gi...@apache.org>.
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



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

Posted by GitBox <gi...@apache.org>.
danielsun1106 commented on pull request #1260:
URL: https://github.com/apache/groovy/pull/1260#issuecomment-635029402


   Understood :-)
   Merged. Thanks for your contributing.
   


----------------------------------------------------------------
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