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

Coleen Phillimore coleenp at openjdk.org
Wed Jul 30 10:59:55 UTC 2025


On Tue, 29 Jul 2025 21:59:41 GMT, ExE Boss <duke at openjdk.org> wrote:

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

I don't think inner class attributes can be changed via JVMTI RedefineClasses either.  I'm pretty sure we check and that's considered a change of schema.  File an RFE to make SharedSecrets fields @Stable though for a different change.

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

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


More information about the core-libs-dev mailing list