Skip to content

Commit cdb41ba

Browse files
committed
8255904: Remove superfluous use of reflection in Class::isRecord
Reviewed-by: redestad, alanb
1 parent c45725e commit cdb41ba

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/java.base/share/classes/java/lang/Class.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3660,16 +3660,6 @@ public boolean isEnum() {
36603660
this.getSuperclass() == java.lang.Enum.class;
36613661
}
36623662

3663-
/** java.lang.Record.class */
3664-
private static final Class<?> JAVA_LANG_RECORD_CLASS = javaLangRecordClass();
3665-
private static Class<?> javaLangRecordClass() {
3666-
try {
3667-
return Class.forName0("java.lang.Record", false, null, null);
3668-
} catch (ClassNotFoundException e) {
3669-
throw new InternalError("should not reach here", e);
3670-
}
3671-
}
3672-
36733663
/**
36743664
* Returns {@code true} if and only if this class is a record class.
36753665
*
@@ -3686,7 +3676,7 @@ private static Class<?> javaLangRecordClass() {
36863676
* @since 16
36873677
*/
36883678
public boolean isRecord() {
3689-
return getSuperclass() == JAVA_LANG_RECORD_CLASS && isRecord0();
3679+
return getSuperclass() == java.lang.Record.class && isRecord0();
36903680
}
36913681

36923682
// Fetches the factory for reflective objects

0 commit comments

Comments
 (0)