RFR(xs): 8199394: Object.hashCode should not mention anything about memory addresses
Stuart Marks
stuart.marks at oracle.com
Fri Dec 7 02:06:58 UTC 2018
Hi all,
Please review this small update to the Object.hashCode spec to remove mention of
memory addresses. This also moves the statement about the implementation of
hashCode in the Object class into an @implSpec section.
Bug:
https://bugs.openjdk.java.net/browse/JDK-8199394
Patch appended below.
(I will file a CSR before pushing this changeset.)
Thanks,
s'marks
# HG changeset patch
# User smarks
# Date 1544148151 28800
# Thu Dec 06 18:02:31 2018 -0800
# Node ID abc83502ef65c408cddd0bb5dd3985ac70946427
# Parent 0d89f672c62eeec74547c20c822dfde8edbf9b62
8199394: Object.hashCode should not mention anything about memory addresses
Reviewed-by: XXX
diff -r 0d89f672c62e -r abc83502ef65
src/java.base/share/classes/java/lang/Object.java
--- a/src/java.base/share/classes/java/lang/Object.java Thu Dec 06 14:34:11 2018
-0800
+++ b/src/java.base/share/classes/java/lang/Object.java Thu Dec 06 18:02:31 2018
-0800
@@ -94,12 +94,10 @@
* programmer should be aware that producing distinct integer results
* for unequal objects may improve the performance of hash tables.
* </ul>
- * <p>
- * As much as is reasonably practical, the hashCode method defined
- * by class {@code Object} does return distinct integers for
- * distinct objects. (The hashCode may or may not be implemented
- * as some function of an object's memory address at some point
- * in time.)
+ *
+ * @implSpec
+ * As much as is reasonably practical, the {@code hashCode} method defined
+ * by class {@code Object} returns distinct integers for distinct objects.
*
* @return a hash code value for this object.
* @see java.lang.Object#equals(java.lang.Object)
More information about the core-libs-dev
mailing list