RFR: 8376023: Reconcile ClassUnloader with ClassUnloadCommon [v2]

David Holmes dholmes at openjdk.org
Tue Feb 10 03:26:29 UTC 2026


On Tue, 10 Feb 2026 03:23:11 GMT, SendaoYan <syan at openjdk.org> wrote:

>> Hi all,
>> 
>> This PR merge test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java to test/lib/jdk/test/lib/classloader/ClassUnloadCommon.java, and make the vmTestbase tests use the ClassUnloadCommon.
>> 
>> The core method in test/hotspot/jtreg/vmTestbase/nsk/share/ClassUnloader.java is `boolean unloadClass()`, and the core method in test/lib/jdk/test/lib/classloader/ClassUnloadCommon.java is `Set<String> triggerUnloading(List<String> classNames)`, it's not easy to combile these two methods to one. So I keep all these two methods.
>> 
>> Additional testing:
>> 
>> - [x] Full jtreg tests include vmTestbase
>
> SendaoYan has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 31 additional commits since the last revision:
> 
>  - Fix missed attempt++
>  - Add "import jdk.test.lib.classloader.CustomClassLoader;" for vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/TestDescription.java etc..
>  - Adapt DEFAULT_BREAKPOINT_LINE from 63 to 65, since two lines added to test/hotspot/jtreg/vmTestbase/nsk/share/jpda/AbstractDebuggeeTest.java
>  - Add "import jdk.test.lib.classloader.ClassFileFinder"
>  - fix vmTestbase/nsk/jdi/Scenarios/invokeMethod/redefineclasses001/TestDescription.java fails "cannot find symbol ClassFileFind"
>  - sed -i "s|import nsk.share.CustomClassLoader;|import jdk.test.lib.classloader.CustomClassLoader;|" `grep nsk.share.CustomClassLoader test/ -rnl `
>  - Fix test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassUnloadEvent/className/classname001/TestDescription.java fails "cannot find user-defined classloader loaded: nsk.share.CustomClassLoader"
>  - Fix javac error: "AbstractDebuggeeTest.java:103: error: cannot find symbol"
>  - Merge branch 'openjdk:master' into jbs8376023
>  - Fix comment in test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassObjectReference/reflectedType/reflectype002/TestDescription.java
>  - ... and 21 more: https://git.openjdk.org/jdk/compare/717f7a39...bff25ebf

Sorry but no. Nothing in test/lib should have a dependency back into the nsk files. vmTestbase is legacy code. If ClassUnloadCommon needs additional nsk classes then they should also be moved into the test library.

test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java line 30:

> 28:  * @requires vm.flagless
> 29:  * @modules java.base/jdk.internal.misc
> 30:  * @library /test/lib /vmTestbase

This test should not be using anything in vmTestbase!

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

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/29545#pullrequestreview-3749331104
PR Review Comment: https://git.openjdk.org/jdk/pull/29545#discussion_r2762489720


More information about the serviceability-dev mailing list