RFR: 8297740: runtime/ClassUnload/UnloadTest.java failed with "Test failed: should still be live"
David Holmes
dholmes at openjdk.org
Wed Nov 30 00:27:19 UTC 2022
On Tue, 29 Nov 2022 09:28:28 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
> Fix the failure in `-Xcomp` mode. Thanks to David's analysis that a local variable is not enough to keep the object live; using a global variable now.
Making the reference static should fix the issue but you no longer need the local reference. You could just keep the 'o' name on the global and avoid any other changes.
Thanks.
test/hotspot/jtreg/runtime/ClassUnload/UnloadTest.java line 51:
> 49: */
> 50: public class UnloadTest {
> 51: // JDK-8297740: using a global static field to keep the object live in -Xcomp mode.
No need to reference the bug in the comment - we don't generally do that. You could add it to `@bug` list.
test/hotspot/jtreg/runtime/ClassUnload/UnloadTest.java line 67:
> 65: ClassLoader cl = ClassUnloadCommon.newClassLoader();
> 66: Object o = cl.loadClass(className).newInstance();
> 67: global_o = o;
You don't need the local 'o' any more.
-------------
Changes requested by dholmes (Reviewer).
PR: https://git.openjdk.org/jdk/pull/11409
More information about the hotspot-runtime-dev
mailing list