DataFlavors violates Object.hashCode contract in two ways

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P3
    • None
    • Affects Version/s: 1.2.0
    • Component/s: client-libs
    • None
    • generic
    • generic

          The DataFlavor class override Object.equals but not Object.hashCode. This violates the restriction that:

      a.equals(b) ==> a.hashCode()==b.hashCode()

          Further, the equals function returns true when a DataFlavor is compare to
      certain Strings and MimeTypes. This is extremely bad! It violates the
      transitivity restriction on the equals method in a highly visible fashion.


      If our customers use objects of this class as keys in Hashtables or
      HashMaps, or elements in HashSets, the basic invariants of the collections will
      be corrupted, leading to erratic behavior.

            Assignee:
            Lara Bunni (Inactive)
            Reporter:
            Josh Bloch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: