8291360: Create entry points to expose low-level class file information

Reviewed-by: dholmes, rriggs
This commit is contained in:
Harold Seigel 2022-08-04 13:13:01 +00:00
parent ce61eb6ff9
commit a3040fcc2b
9 changed files with 812 additions and 1 deletions

View file

@ -4668,4 +4668,34 @@ public final class Class<T> implements java.io.Serializable,
}
private native Class<?>[] getPermittedSubclasses0();
/*
* Return the class's major and minor class file version packed into an int.
* The high order 16 bits contain the class's minor version. The low order
* 16 bits contain the class's major version.
*
* If the class is an array type then the class file version of its element
* type is returned. If the class is a primitive type then the latest class
* file major version is returned and zero is returned for the minor version.
*/
private int getClassFileVersion() {
Class<?> c = isArray() ? elementType() : this;
return c.getClassFileVersion0();
}
private native int getClassFileVersion0();
/*
* Return the access flags as they were in the class's bytecode, including
* the original setting of ACC_SUPER.
*
* If the class is an array type then the access flags of the element type is
* returned. If the class is a primitive then ACC_ABSTRACT | ACC_FINAL | ACC_PUBLIC.
*/
private int getClassAccessFlagsRaw() {
Class<?> c = isArray() ? elementType() : this;
return c.getClassAccessFlagsRaw0();
}
private native int getClassAccessFlagsRaw0();
}