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

David Holmes dholmes at openjdk.org
Thu Feb 20 02:52:58 UTC 2025


On Wed, 19 Feb 2025 20:30:34 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Class.isInterface() can check modifier flags, Class.isArray() can check whether component mirror is non-null and Class.isPrimitive() needs a new final transient boolean in java.lang.Class that the JVM code initializes.
>> Tested with tier1-4 and performance tests.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Rename isPrimitiveType field to primitive.

src/java.base/share/classes/java/lang/Class.java line 1296:

> 1294: 
> 1295:     // The componentType field's null value is the sole indication that the class is an array,
> 1296:     // see isArray().

Suggestion:

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

src/java.base/share/classes/java/lang/Class.java line 1297:

> 1295:     // The componentType field's null value is the sole indication that the class is an array,
> 1296:     // see isArray().
> 1297:     private transient final Class<?> componentType;

Why the `transient` and how does this impact serialization??

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23572#discussion_r1962781718
PR Review Comment: https://git.openjdk.org/jdk/pull/23572#discussion_r1962782083


More information about the core-libs-dev mailing list