mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8255904: Remove superfluous use of reflection in Class::isRecord
Reviewed-by: redestad, alanb
This commit is contained in:
parent
c45725e587
commit
cdb41ba1d0
1 changed files with 1 additions and 11 deletions
|
@ -3660,16 +3660,6 @@ public final class Class<T> implements java.io.Serializable,
|
|||
this.getSuperclass() == java.lang.Enum.class;
|
||||
}
|
||||
|
||||
/** java.lang.Record.class */
|
||||
private static final Class<?> JAVA_LANG_RECORD_CLASS = javaLangRecordClass();
|
||||
private static Class<?> javaLangRecordClass() {
|
||||
try {
|
||||
return Class.forName0("java.lang.Record", false, null, null);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new InternalError("should not reach here", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if and only if this class is a record class.
|
||||
*
|
||||
|
@ -3686,7 +3676,7 @@ public final class Class<T> implements java.io.Serializable,
|
|||
* @since 16
|
||||
*/
|
||||
public boolean isRecord() {
|
||||
return getSuperclass() == JAVA_LANG_RECORD_CLASS && isRecord0();
|
||||
return getSuperclass() == java.lang.Record.class && isRecord0();
|
||||
}
|
||||
|
||||
// Fetches the factory for reflective objects
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue