RFR: 8364187: Make getClassAccessFlagsRaw non-native [v2]

Coleen Phillimore coleenp at openjdk.org
Tue Jul 29 19:58:14 UTC 2025


On Tue, 29 Jul 2025 16:40:22 GMT, ExE Boss <duke at openjdk.org> wrote:

>> 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.
>
> Arguably, the fields in `SharedSecrets` should be made `@Stable`.

Okay, I'll remove the Holder class.  I copied it from another method in the file.  yeah, sorry for the additional shared secret but I didn't want to make the java.lang.Class method public.

I didn't add a field to SharedSecrets, and the field in Class is transient which I think supersedes @Stable - at least that's what I remember from our discussion of the modifiers field in Class.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26517#discussion_r2240789122


More information about the core-libs-dev mailing list