On Tue, 3 Feb 2026 22:10:30 GMT, Chris Plummer <[email protected]> wrote:

> Was there any merger of the functionality of these two files, or did you just 
> move the ClassUnloader.java contents into ClassUnloadCommon.java?

I almost just move the ClassUnloader.java contents into 
ClassUnloaderCommon.java, except for make both file use the same variable 
`MAX_UNLOAD_ATTEMPS`.

The core method in test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java 
is `boolean unloadClass()`, it check the classloader has been reclaimed or not 
to determise the class[es] has been unload or not.
And the core method in test/lib/jdk/test/lib/classloader/ClassUnloadCommon.java 
is `Set<String> triggerUnloading(List<String> classNames)`, it check the 
`WhiteBox.isClassAlive(className)`  for every loaded class[es] to determise the 
loaded class[es] has been unload or not.

These two unload methods has different usages and different ways of classloader 
technology, we can not combine them to one directively. If we want to combine 
them to one, we should adapt all the releated tests at the same time.

The classloader in the original 
test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java only support load 
the class which locate in the test.class.path, but the classloader in the 
original test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java can load 
the class by the given directory. So we can not make the vmTestbase tests use 
the load/unload method in the original 
test/lib/jdk/test/lib/classloader/ClassUnloadCommon.java.

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

PR Comment: https://git.openjdk.org/jdk/pull/29545#issuecomment-3845129033

Reply via email to