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

Patricio Chilano Mateo pchilanomate at openjdk.org
Mon Jun 2 14:24:10 UTC 2025


> Please review this small test fix. When running LoaderConstraintsTest with `TEST_THREAD_FACTORY=Virtual` we load class `java.lang.Class` earlier than expected which causes the test to fail because of a missing loader constraint logging output. I added the full details of the issue in the JBS comments. 
> 
> The fix changes the constraint we look for to be on class `java.lang.String` between classloader `ClassUnloadCommonClassLoader` and the bootstrap classloader. This allows the test to be more robust and not depend on some hidden behavior. In fact, the only line that is currently needed for the test to pass for the platform thread case is the call to `ClassUnloadCommon.newClassLoader()`, which seems a bit obscure. Also as explained in JBS, the defining loader of `test.Empty` is currently the builtin system classloader, not `ClassUnloadCommonClassLoader` as the test would suggest.
> 
> Thanks,
> Patricio

Patricio Chilano Mateo has updated the pull request incrementally with one additional commit since the last revision:

  Add WhiteBox back + typo

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25496/files
  - new: https://git.openjdk.org/jdk/pull/25496/files/2fc8d84c..c65e036b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25496&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25496&range=00-01

  Stats: 5 lines in 1 file changed: 4 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/25496.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25496/head:pull/25496

PR: https://git.openjdk.org/jdk/pull/25496


More information about the hotspot-runtime-dev mailing list