Skip to content

Commit 0965a48

Browse files
committed
Use class modifiers to detect primitive classes
1 parent 7b95884 commit 0965a48

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
@@ -74,10 +74,6 @@ public boolean isArray() {
7474
return dims.intValue() > 0 || CompilerIntrinsics.isPrimArray(typeId);
7575
}
7676

77-
public boolean isPrimitive() {
78-
return CompilerIntrinsics.isPrimitive(CompilerIntrinsics.getTypeIdFromClass((Class<?>)(Object)this));
79-
}
80-
8177
public Class<? super T> getSuperclass() {
8278
type_id typeId = CompilerIntrinsics.getTypeIdFromClass((Class<?>)(Object)this);
8379
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
@@ -230,6 +230,11 @@ public Class<?> getNestHost() {
230230
return nestHost;
231231
}
232232

233+
@Replace
234+
public boolean isPrimitive() {
235+
return (modifiers & (1 << 17)) != 0;
236+
}
237+
233238
// todo: @Replace public Class<?> arrayType() { ... }
234239
// todo: @Replace public Class<?> componentType() { ... }
235240
// todo: @Remove private final Class<?> componentType;

0 commit comments

Comments
 (0)