< prev index next >

src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template

Print this page
rev 53074 : 8215648: remove equals and hashCode implementations from j.l.i.VarHandle

@@ -62,21 +62,10 @@
         final MethodType accessModeTypeUncached(AccessMode accessMode) {
             return accessMode.at.accessModeType(receiverType, {#if[Object]?fieldType:$type$.class});
         }
 
         @Override
-        final boolean internalEquals(VarHandle vh) {
-            FieldInstanceReadOnly that = (FieldInstanceReadOnly) vh;
-            return fieldOffset == that.fieldOffset;
-        }
-
-        @Override
-        final int internalHashCode() {
-            return Long.hashCode(fieldOffset);
-        }
-
-        @Override
         public Optional<VarHandleDesc> describeConstable() {
             var receiverTypeRef = receiverType.describeConstable();
             var fieldTypeRef = {#if[Object]?fieldType:$type$.class}.describeConstable();
             if (!receiverTypeRef.isPresent() || !fieldTypeRef.isPresent())
                 return Optional.empty();

@@ -348,21 +337,10 @@
             this.fieldType = fieldType;
 #end[Object]
         }
 
         @Override
-        final boolean internalEquals(VarHandle vh) {
-            FieldStaticReadOnly that = (FieldStaticReadOnly) vh;
-            return base == that.base && fieldOffset == that.fieldOffset;
-        }
-
-        @Override
-        final int internalHashCode() {
-            return 31 * Long.hashCode(fieldOffset) + base.hashCode();
-        }
-
-        @Override
         public Optional<VarHandleDesc> describeConstable() {
             var fieldTypeRef = {#if[Object]?fieldType:$type$.class}.describeConstable();
             if (!fieldTypeRef.isPresent())
                 return Optional.empty();
 

@@ -638,24 +616,10 @@
             this.componentType = arrayType.getComponentType();
 #end[Object]
         }
 
         @Override
-        final boolean internalEquals(VarHandle vh) {
-            // Equality of access mode types of AccessMode.GET is sufficient for
-            // equality checks
-            return true;
-        }
-
-        @Override
-        final int internalHashCode() {
-            // The hash code of the access mode types of AccessMode.GET is
-            // sufficient for hash code generation
-            return 0;
-        }
-
-        @Override
         public Optional<VarHandleDesc> describeConstable() {
             var arrayTypeRef = {#if[Object]?arrayType:$type$[].class}.describeConstable();
             if (!arrayTypeRef.isPresent())
                 return Optional.empty();
 
< prev index next >