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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7-pool, 8
    • Fix Version/s: 8
    • Component/s: core-libs
    • Labels:

      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

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

                  Dates

                  Created:
                  Updated:
                  Resolved: