Skip to content

Commit e3cf553

Browse files
committed
Use class modifiers to detect primitive classes
1 parent b7cd676 commit e3cf553

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

java.base/src/main/java/java/lang/Class$_native.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ public boolean isArray() {
100100
return dims.intValue() > 0 || CompilerIntrinsics.isPrimArray(typeId);
101101
}
102102

103-
public boolean isPrimitive() {
104-
return CompilerIntrinsics.isPrimitive(CompilerIntrinsics.getTypeIdFromClass((Class<?>)(Object)this));
105-
}
106-
107103
public Class<? super T> getSuperclass() {
108104
type_id typeId = CompilerIntrinsics.getTypeIdFromClass((Class<?>)(Object)this);
109105
if (CompilerIntrinsics.isJavaLangObject(typeId) || CompilerIntrinsics.isPrimitive(typeId) || CompilerIntrinsics.isInterface(typeId)) {

java.base/src/main/java/java/lang/Class$_patch.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,11 @@ public Class<?> getNestHost() {
284284
return qbiccReflectionData;
285285
}
286286

287+
@Replace
288+
public boolean isPrimitive() {
289+
return (modifiers & (1 << 17)) != 0;
290+
}
291+
287292
// todo: @Replace public Class<?> arrayType() { ... }
288293
// todo: @Replace public Class<?> componentType() { ... }
289294
// todo: @Remove private final Class<?> componentType;

0 commit comments

Comments
 (0)