RFR: 8364187: Make getClassAccessFlagsRaw non-native [v2]
Roger Riggs
rriggs at openjdk.org
Tue Jul 29 15:02:59 UTC 2025
On Tue, 29 Jul 2025 13:43:35 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> This change removes the intrinsic for getClassAccessFlagsRaw for reflection and initializes an rawAccessFlags field in java.lang.Class instead, that Java code can non-natively access.
>> Tested with tier1-4.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>
> Rename getRawClassAccessFlags to getClassFileAccessFlags and fix the test to reflect what the JVM does.
src/java.base/share/classes/java/lang/Class.java line 248:
> 246: protectionDomain = pd;
> 247: primitive = isPrim;
> 248: classFileAccessFlags = flags;
Its not that hard to add a field, why not have done this for identity?
src/java.base/share/classes/java/lang/Class.java line 4143:
> 4141: * {@code FINAL}.
> 4142: * If this {@code Class} object represents an array type return 0. This
> 4143: * is not called in Class but can be called with an array type in Reflection.
The comment about "not called in Class" may get stale. I don't think it needs to be specified.
src/java.base/share/classes/jdk/internal/reflect/Reflection.java line 87:
> 85: class Holder {
> 86: static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
> 87: }
Yuck, another class and another shared secret.
There's no need for a Holder class, just call SharedSecrets.getJavaLangAccess every time.
It just returning a value from a static field.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26517#discussion_r2240132537
PR Review Comment: https://git.openjdk.org/jdk/pull/26517#discussion_r2240117128
PR Review Comment: https://git.openjdk.org/jdk/pull/26517#discussion_r2240126279
More information about the core-libs-dev
mailing list