You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Neidhart (JIRA)" <ji...@apache.org> on 2013/04/23 21:37:16 UTC

[jira] [Commented] (COLLECTIONS-340) NOPClosure has a broken equals method

    [ https://issues.apache.org/jira/browse/COLLECTIONS-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13639470#comment-13639470 ] 

Thomas Neidhart commented on COLLECTIONS-340:
---------------------------------------------

It looks like this change has been lost during the generics_branch merge.
I think we can keep it as is and highlight it in the release notes.
                
> NOPClosure has a broken equals method
> -------------------------------------
>
>                 Key: COLLECTIONS-340
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-340
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Functor
>            Reporter: Goran Hacek
>            Priority: Minor
>             Fix For: 4.0
>
>
> Equals method of NOPClosure class doesn't follow objects equals contract. It isn't symmetric nor transitive and it is just plain wrong.
> Following code evaluates to true on most (if not all) JVM implementations:
> {noformat} NOPClosure.INSTANCE.equals(new Integer(System.identityHashCode(NOPClosure.INSTANCE))) {noformat} 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira