RFR: 8357910: LoaderConstraintsTest.java fails when run with TEST_THREAD_FACTORY=Virtual [v2]

Patricio Chilano Mateo pchilanomate at openjdk.org
Mon Jun 2 22:47:53 UTC 2025


On Mon, 2 Jun 2025 21:43:11 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Patricio Chilano Mateo has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add WhiteBox back + typo
>
> test/hotspot/jtreg/runtime/logging/LoaderConstraintsTest.java line 56:
> 
>> 54:             Class<?> c = cl.loadClass(className);
>> 55:             cl = null; c = null;
>> 56:             ClassUnloadCommon.triggerUnloading();
> 
> So the unloading is not part of this test? Are we just using the ClassUnloadCommon utility as a convenient way to get an additional classloader involved?

Yes, the unloading part is not needed. Before this patch, the only line needed was `ClassLoader cl = ClassUnloadCommon.newClassLoader();`. That would already trigger the constraint we checked for in the parent. But it doesn't work for virtual threads, so I changed it to check for a constraint on the created `ClassUnloadCommonClassLoader` instead to avoid dependencies on previously executed code like with the `app` classloader.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25496#discussion_r2122286788


More information about the hotspot-runtime-dev mailing list