On Thu, 30 Jul 2026 16:15:40 GMT, Chen Liang <[email protected]> wrote:

>> src/java.base/share/classes/java/lang/Class.java line 3327:
>> 
>>> 3325:      */
>>> 3326:     public boolean desiredAssertionStatus() {
>>> 3327:         if (isPrimitive() || isArray()) return false;
>> 
>> This is mostly invoked from a compiled-generated class initializer when code 
>> in the class was compiled with the "assert" keyword. Not common but you 
>> sometimes see code invoking it directly, maybe to have -ea turn on a 
>> debugging flag. I don't think I've never seen code using something other 
>> than the "current class". So primitive and array classes is very weird. 
>> Having it return false because that is long standing behavior should be okay 
>> and should be specified. Is there any reason to do the spec update 
>> separately?
>
> This patch aims to avoid calling JVM_DesiredAssertionStatus on a primitive or 
> array class receiver, which would trigger an assert present since its 
> introduction before OpenJDK in debug builds.

Sure, but the need to clarify the spec jumps out, I don't mind if it is done in 
a separate issue.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32086#discussion_r3684466603

Reply via email to