8141677: Improve java.lang.invoke.MemberName hashCode implementation
authorredestad
Mon, 09 Nov 2015 17:14:05 +0100
changeset 33649 5e51019fc94d
parent 33648 9564031a20e0
child 33650 c99ead4a890b
8141677: Improve java.lang.invoke.MemberName hashCode implementation Reviewed-by: vlivanov, psandoz, shade
jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java	Mon Nov 09 11:02:07 2015 -0500
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MemberName.java	Mon Nov 09 17:14:05 2015 +0100
@@ -694,8 +694,11 @@
 
     @Override
     public int hashCode() {
-        return Objects.hash(clazz, getReferenceKind(), name, getType());
+        // Avoid autoboxing getReferenceKind(), since this is used early and will force
+        // early initialization of Byte$ByteCache
+        return Objects.hash(clazz, new Byte(getReferenceKind()), name, getType());
     }
+
     @Override
     public boolean equals(Object that) {
         return (that instanceof MemberName && this.equals((MemberName)that));