8334772: Change Class::signers to an explicit field

Reviewed-by: dholmes, alanb, rriggs, coleenp
This commit is contained in:
Chen Liang 2024-07-18 22:22:59 +00:00
parent 902c2afb67
commit 39f4476813
6 changed files with 19 additions and 66 deletions

View file

@ -1110,8 +1110,8 @@ public final class Class<T> implements java.io.Serializable,
// will throw NoSuchFieldException
private final ClassLoader classLoader;
// Set by VM
private transient Object classData;
private transient Object classData; // Set by VM
private transient Object[] signers; // Read by VM, mutable
// package-private
Object getClassData() {
@ -1510,14 +1510,19 @@ public final class Class<T> implements java.io.Serializable,
* a primitive type or void.
* @since 1.1
*/
public native Object[] getSigners();
public Object[] getSigners() {
var signers = this.signers;
return signers == null ? null : signers.clone();
}
/**
* Set the signers of this class.
*/
native void setSigners(Object[] signers);
void setSigners(Object[] signers) {
if (!isPrimitive() && !isArray()) {
this.signers = signers;
}
}
/**
* If this {@code Class} object represents a local or anonymous