[jira] [Commented] (GROOVY-9575) ASTNode.hashCode violates Object.hashCode contract: does not return consistent value

2020-05-27 Thread Anders Wallgren (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-9575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17118198#comment-17118198
 ] 

Anders Wallgren commented on GROOVY-9575:
-

My pleasure! Thank you for the fast response and (it looks like) getting it 
into 3.0.5. Much appreciated.

> ASTNode.hashCode violates Object.hashCode contract: does not return 
> consistent value
> 
>
> Key: GROOVY-9575
> URL: https://issues.apache.org/jira/browse/GROOVY-9575
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.4
>Reporter: Anders Wallgren
>Assignee: Daniel Sun
>Priority: Major
> Fix For: 4.0.0-alpha-1, 3.0.5
>
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> While upgrading groovy from 2.4.18 to 3.0.4 in a project we ran into a 
> problem: ASTNode.hashCode uses mutable properties of the object to calculate 
> the hash.
> Those object properties are not, however, used when equals() is invoked on an 
> ASTNode instance (as of 3.0.4 ASTNode does not implement equals).
> This means ASTNode violates an important part of the Object.hashCode contract 
> and you cannot safely put ASTNode instances into collections where the 
> hashcode is relied upon to be consistent.
> Quoting the Object.hashCode javadoc:
>  * 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.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (GROOVY-9575) ASTNode.hashCode violates Object.hashCode contract: does not return consistent value

2020-05-26 Thread Anders Wallgren (Jira)


[ 
https://issues.apache.org/jira/browse/GROOVY-9575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17117255#comment-17117255
 ] 

Anders Wallgren commented on GROOVY-9575:
-

[https://github.com/apache/groovy/pull/1260]

> ASTNode.hashCode violates Object.hashCode contract: does not return 
> consistent value
> 
>
> Key: GROOVY-9575
> URL: https://issues.apache.org/jira/browse/GROOVY-9575
> Project: Groovy
>  Issue Type: Bug
>Affects Versions: 3.0.4
>Reporter: Anders Wallgren
>Priority: Major
>
> While upgrading groovy from 2.4.18 to 3.0.4 in a project we ran into a 
> problem: ASTNode.hashCode uses mutable properties of the object to calculate 
> the hash.
> Those object properties are not, however, used when equals() is invoked on an 
> ASTNode instance (as of 3.0.4 ASTNode does not implement equals).
> This means ASTNode violates an important part of the Object.hashCode contract 
> and you cannot safely put ASTNode instances into collections where the 
> hashcode is relied upon to be consistent.
> Quoting the Object.hashCode javadoc:
>  * 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.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)