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

Object.hashCode should not mention anything about memory addresses

XMLWordPrintable

    • b24

      The spec for Object.hashCode says in part,

          (The hashCode may or may not be implemented as some function
          of an object's memory address at some point in time.)

      In the early days of Java it might have been the case that the default hashCode was based on the address, but this hasn't been true for quite some time. It's misleading to mention the object's address here, and this continues to cause confusion.

      This statement should simply be removed.

            smarks Stuart Marks
            smarks Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: