mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8215648: remove equals and hashCode implementations from j.l.i.VarHandle
Reviewed-by: mchung
This commit is contained in:
parent
8243e7f9fa
commit
0032475ef1
19 changed files with 19 additions and 126 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -1864,35 +1864,6 @@ public abstract class VarHandle implements Constable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue