RFR: 8349860: Make Class.isArray(), Class.isInterface() and Class.isPrimitive() non-native [v3]
Coleen Phillimore
coleenp at openjdk.org
Thu Feb 20 13:00:03 UTC 2025
On Thu, 20 Feb 2025 04:29:04 GMT, Chen Liang <liach at openjdk.org> wrote:
>> 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??
>
> The fields in `Class` are just inconsistently transient or not. `Class` has special treatment in the serialization specification, so the presence or absence of the `transient` modifier has no effect.
Thanks Chen. I was wondering why the other JVM installed fields were transient and this one wasn't so I added it to see if someone noticed and could verify whether it's right or not.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23572#discussion_r1963520059
More information about the core-libs-dev
mailing list