On Wed, 29 Jul 2026 21:19:14 GMT, Coleen Phillimore <[email protected]> wrote:

>> This fixes a longstanding problem with desiredAssertionStatus and adds a 
>> test.
>> Tested with tier1.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Coleen Phillimore has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Fix test.

src/hotspot/share/prims/jvm.cpp line 2225:

> 2223:   Klass* k = java_lang_Class::as_Klass(r);
> 2224:   assert(k->is_instance_klass(), "must be an instance klass");
> 2225:   if (!k->is_instance_klass()) return false;

I don't believe this is right for arrays. With this change the assertion status 
of `T[]` where `T` is loaded by the boot-loader, is made the same as the 
assertion status of `T`. According to the spec however "the system class 
default assertion status is returned".

test/jdk/java/lang/Class/desiredAssertionStatus/Sanity.java line 47:

> 45:         Assert.assertTrue(Object[].class.desiredAssertionStatus() == 
> systemDefaultOn);
> 46:         Assert.assertTrue(Sanity.class.desiredAssertionStatus() == 
> userDefaultOn);
> 47:         Assert.assertTrue(Sanity[].class.desiredAssertionStatus() == 
> userDefaultOn);

You should be testing the primitive class instances here as well.

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

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

Reply via email to