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

Many classes violate Object.hashCode contract

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      generic, x86
    • OS:
      generic, windows_nt

      Description

          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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: