On Mon, 8 Jun 2026 18:37:37 GMT, Chen Liang <[email protected]> wrote:

>> The specification of JVMTI GetClassModifiers needs some TLC. The spec was 
>> carried over from the equivalent function in JVMDI but doesn't really 
>> specify that it works like Class::getModifiers and returns Java language 
>> modifiers and not necessarily the access flags from the class file. The 
>> change in behavior to only set ACC_IDENTITY when the class is an identity 
>> class or array makes it a good time to re-write the spec to align with 
>> existing and future behavior.
>> 
>> A new test is added to test this function with value classes. The tests are 
>> added to the "newer" serviceability/jvmti tree. There are some older tests 
>> for GetClassModifiers in vmTestbase/nsk suite so there is a bit of an 
>> overlap.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/hotspot/share/prims/jvmti.xml line 7396:
> 
>> 7394:         When preview features are disabled, the <code>ACC_SUPER</code> 
>> access flag may
>> 7395:         be set if <code>klass</code> is not a primitive type or void. 
>> The flag has no
>> 7396:         effective meaning.
> 
> I think we can be more assertive, like:
> "the ACC_IDENTITY access flag is set if and only if klass is an identity 
> class or an array class"
> 
> "the ACC_SUPER access flag is set if and only if klass is not a primitive 
> type or void"

For ACC_IDENTITY then using "if and only if" would be better, thanks!

For ACC_SUPER, the context is optional implementation-specific/undocumented 
behavior so I don't think "if and only if" work would there. I've tweaked the 
wording from "may be set" to "may be set only" to try to make this clearer.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2526#discussion_r3379587273

Reply via email to