< prev index next >

src/java.base/share/classes/java/lang/invoke/VarHandle.java

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

*** 1863,1901 **** this.mode = mode; } } /** - * Compare this {@linkplain VarHandle} with another object for equality. - * Two {@linkplain VarHandle}s are considered equal if they both describe the - * same instance field, both describe the same static field, both describe - * array elements for arrays with the same component type, or both describe - * the same component of an off-heap structure. - * - * @param o the other object - * @return Whether this {@linkplain VarHandle} is equal to the other object - */ - @Override - public final boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - VarHandle that = (VarHandle) o; - return accessModeType(AccessMode.GET).equals(that.accessModeType(AccessMode.GET)) && - internalEquals(that); - } - - abstract boolean internalEquals(VarHandle vh); - - @Override - public final int hashCode() { - return 31 * accessModeType(AccessMode.GET).hashCode() + internalHashCode(); - } - - abstract int internalHashCode(); - - /** * Returns a compact textual description of this {@linkplain VarHandle}, * including the type of variable described, and a description of its coordinates. * * @return A compact textual description of this {@linkplain VarHandle} */ --- 1863,1872 ----
< prev index next >