RFR: 8349860: Make Class.isArray(), Class.isInterface() and Class.isPrimitive() non-native [v2]

Coleen Phillimore coleenp at openjdk.org
Wed Feb 19 18:40:37 UTC 2025


On Wed, 19 Feb 2025 15:07:57 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Code review comments.
>
> src/hotspot/share/prims/jvm.cpp line 2284:
> 
>> 2282: // Please, refer to the description in the jvmtiThreadState.hpp.
>> 2283: 
>> 2284: JVM_ENTRY(jboolean, JVM_IsInterface(JNIEnv *env, jclass cls))
> 
> JVM_IsInteface is deleted in Class.c, what purpose is this?

The old classfile verifier uses JVM_IsInterface.

> src/java.base/share/classes/java/lang/Class.java line 807:
> 
>> 805:      */
>> 806:     public boolean isArray() {
>> 807:         return componentType != null;
> 
> The componentType declaration should have a comment indicating that == null is the sole indication that the class is an interface.
> Perhaps there should be an assert somewhere validating/cross checking that requirement.

I added an assert for set_component_mirror() in the vm, but I don't see how to assert it in Java.  Is the comment like:

// The componentType field's null value is the sole indication that the class is an array, see isArray()

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23572#discussion_r1962078501
PR Review Comment: https://git.openjdk.org/jdk/pull/23572#discussion_r1962186820


More information about the core-libs-dev mailing list