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

Hashtable.Entry.hashCode() no longer conforms to Map.Entry.hashCode()

XMLWordPrintable

      Neil Richards <neil.richards@ngmr.net> reports:

      I notice that the behaviour of java.util.Hashtable.Entry.hashCode() no
      longer conforms to the defined behaviour (in the Java API Javadoc [1])
      for java.util.Map.Entry.hashCode() implementations.

      The code in Hashtable.Entry.hashCode() assumes that the value in
      Hashtable.Entry.hash will always be the same as that for
      Hashtable.Entry.getKey().hashCode() .

      However, since Java bug 7126277 (Alternative String hashing
      implementation), the use of Hashtable.hashSeed, a randomizing factor,
      has been introduced into the calculation of Hashtable.hash().

      It is the result from Hashtable.hash() which ends up stored in the
      Hashtable.Entry.hash field.

      So the assumption made in Hashtable.Entry.hashCode() is no longer valid,
      and the code needs to be corrected, so that it once more complies with
      the Java API defined behaviour.

            Unassigned Unassigned
            mduigou Mike Duigou
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: