Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4157612

Many classes violate Object.hashCode contract

XMLWordPrintable

    • beta
    • generic, x86
    • generic, windows_nt

          The AffineTransform, Dimension, Insets, ColorModel, ComponentColorModel, PackedColorModel, AlphaComposite and BasicStroke classes override Object.equals but not Object.hashCode. This violates the restriction that:

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

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

      (Note that I widened the scope of this bug to encompass all of the awt classes
      with this problem, and the wider-scope bug (4157612) was closed as a duplicate
      of this one.)

      joshua.bloch@Eng 1998-09-02

            prssunw Prs Prs (Inactive)
            dbrownelsunw David Brownell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: