RFR: 8172720: Collections.SingletonList::hashCode not spec-compliant
Claes Redestad
claes.redestad at oracle.com
Thu Jan 12 15:42:11 UTC 2017
Hi,
there was an issue with my patch for JDK-8037325 where the
hashCode implemented for Collections.SingletonList was not
compliant with specification, which breaks certain tests.
Bug: https://bugs.openjdk.java.net/browse/JDK-8172720
Trivial fix:
diff -r 59e5101730c8 src/java.base/share/classes/java/util/Collections.java
--- a/src/java.base/share/classes/java/util/Collections.java Thu Jan 12
13:38:27 2017 +0100
+++ b/src/java.base/share/classes/java/util/Collections.java Thu Jan 12
16:39:44 2017 +0100
@@ -4859,7 +4859,7 @@
}
@Override
public int hashCode() {
- return Objects.hashCode(element);
+ return 31 + Objects.hashCode(element);
}
}
More information about the core-libs-dev
mailing list