mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8215300: additional changes to constants API
Reviewed-by: goetz
This commit is contained in:
parent
a3df1d618e
commit
650f3fc113
12 changed files with 96 additions and 24 deletions
|
@ -61,7 +61,8 @@ public interface TypeDescriptor {
|
|||
boolean isArray();
|
||||
|
||||
/**
|
||||
* Does this field descriptor describe a primitive type?
|
||||
* Does this field descriptor describe a primitive type (including void.)
|
||||
*
|
||||
* @return whether this field descriptor describes a primitive type
|
||||
*/
|
||||
boolean isPrimitive();
|
||||
|
|
|
@ -1864,6 +1864,16 @@ 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;
|
||||
|
@ -1883,6 +1893,12 @@ public abstract class VarHandle implements Constable {
|
|||
|
||||
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}
|
||||
*/
|
||||
@Override
|
||||
public final String toString() {
|
||||
return String.format("VarHandle[varType=%s, coord=%s]",
|
||||
|
@ -2272,6 +2288,14 @@ public abstract class VarHandle implements Constable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a compact textual description of this constant description.
|
||||
* For a field {@linkplain VarHandle}, includes the owner, name, and type
|
||||
* of the field, and whether it is static; for an array {@linkplain VarHandle},
|
||||
* the name of the component type.
|
||||
*
|
||||
* @return A compact textual description of this descriptor
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (kind) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue