8141677: Improve java.lang.invoke.MemberName hashCode implementation
Reviewed-by: vlivanov, psandoz, shade
--- 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));