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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 7-pool, 8
    • core-libs

    Backports

      Description

        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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: