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

ExE Boss duke at openjdk.org
Tue Jul 29 22:11:58 UTC 2025


On Tue, 29 Jul 2025 19:46:06 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> 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.

I mean the existing private fields of `SharedSecrets`[^1] so that the JIT is able to constant fold calls to `SharedSecrets​::getJava*Access()` so that it becomes equally as performant as using a `Holder` class.

Modifiers are transient, as those are sourced from the `InnerClasses` attribute, which can be changed when classes are redefined by a **JVMTI** agent, but access flags can’t be changed through redefinition.

[^1]: https://github.com/openjdk/jdk/blob/330ee871315348594171c43aa75b58f6027001af/src/java.base/share/classes/jdk/internal/access/SharedSecrets.java#L62-L92

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

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


More information about the core-libs-dev mailing list