8297740: runtime/ClassUnload/UnloadTest.java failed with "Test failed: should still be live"
Reviewed-by: dcubed
This commit is contained in:
parent
4d730f561f
commit
a97e7d9887
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test UnloadTest
|
||||
* @bug 8210559
|
||||
* @bug 8210559 8297740
|
||||
* @requires vm.opt.final.ClassUnloading
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /test/lib
|
||||
@ -48,6 +48,8 @@ import java.lang.reflect.Array;
|
||||
* and verifies the class is unloaded.
|
||||
*/
|
||||
public class UnloadTest {
|
||||
// Using a global static field to keep the object live in -Xcomp mode.
|
||||
private static Object o;
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
test_unload_instance_klass();
|
||||
@ -61,7 +63,7 @@ public class UnloadTest {
|
||||
ClassUnloadCommon.failIf(wb.isClassAlive(className), "is not expected to be alive yet");
|
||||
|
||||
ClassLoader cl = ClassUnloadCommon.newClassLoader();
|
||||
Object o = cl.loadClass(className).newInstance();
|
||||
o = cl.loadClass(className).newInstance();
|
||||
|
||||
ClassUnloadCommon.failIf(!wb.isClassAlive(className), "should be live here");
|
||||
|
||||
@ -89,7 +91,7 @@ public class UnloadTest {
|
||||
final WhiteBox wb = WhiteBox.getWhiteBox();
|
||||
|
||||
ClassLoader cl = ClassUnloadCommon.newClassLoader();
|
||||
Object o = Array.newInstance(cl.loadClass("test.Empty"), 1);
|
||||
o = Array.newInstance(cl.loadClass("test.Empty"), 1);
|
||||
final String className = o.getClass().getName();
|
||||
|
||||
ClassUnloadCommon.failIf(!wb.isClassAlive(className), "should be live here");
|
||||
|
Loading…
Reference in New Issue
Block a user