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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

ASF GitHub Bot (Jira)

    [ 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