diff --git a/test/hotspot/jtreg/runtime/ClassInitErrors/InitExceptionUnloadTest.java b/test/hotspot/jtreg/runtime/ClassInitErrors/InitExceptionUnloadTest.java index 26a5b5ae01f..efba398a3ca 100644 --- a/test/hotspot/jtreg/runtime/ClassInitErrors/InitExceptionUnloadTest.java +++ b/test/hotspot/jtreg/runtime/ClassInitErrors/InitExceptionUnloadTest.java @@ -32,7 +32,7 @@ * @library /test/lib * @build jdk.test.whitebox.WhiteBox * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -Xlog:class+unload -XX:+WhiteBoxAPI InitExceptionUnloadTest + * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -Xlog:class+unload -XX:+UnlockDiagnosticVMOptions -XX:+PrintMethodData -XX:+WhiteBoxAPI InitExceptionUnloadTest */ import java.io.ByteArrayOutputStream; @@ -105,6 +105,12 @@ private static void verify_stack(Throwable e, String expected, String cause) thr static void test() throws Throwable { ClassLoader cl = ClassUnloadCommon.newClassLoader(); int i = 0; + java.lang.reflect.Constructor cons = cl.loadClass("InitExceptionUnloadTest$SpecialException").getDeclaredConstructor(int.class, String.class); + cons.setAccessible(true); + Object o = cons.newInstance(42, ""); + for (int t = 0; t < 10; t++) { + String.valueOf(o); + } for (String className : classNames) { for (int tries = 2; tries-- > 0; ) { System.err.println("--- try to load " + className); @@ -124,7 +130,7 @@ static void test() throws Throwable { cl = null; ClassUnloadCommon.triggerUnloading(); // should unload these classes for (String className : classNames) { - ClassUnloadCommon.failIf(wb.isClassAlive(className), "should be unloaded"); + ClassUnloadCommon.failIf(wb.isClassAlive(className), className + " should be unloaded"); } } public static void main(java.lang.String[] unused) throws Throwable {