< 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,82 **** 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(); --- 62,71 ----
*** 348,368 **** 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(); --- 337,346 ----
*** 638,661 **** 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(); --- 616,625 ----
< prev index next >