Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-340

NOPClosure has a broken equals method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0-alpha1, 4.0
    • Functor
    • None

    Description

      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:

       NOPClosure.INSTANCE.equals(new Integer(System.identityHashCode(NOPClosure.INSTANCE))) 

      Attachments

        Activity

          People

            Unassigned Unassigned
            ghacek Goran Hacek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: