< prev index next >
test/hotspot/jtreg/runtime/LoaderConstraints/vtableAME/Test.java
Print this page
rev 49654 : 8199852: Print more information about class loaders in LinkageErrors.
*** 46,65 ****
// though it is inheriting the method from its super class C, and Task has
// a different class Foo than C, no LinkageError exception should be thrown
// because the loader constraint check that would cause the LinkageError
// should not be done.
public static void main(String args[]) throws Exception {
! Class<?> c = Foo.class; // forces standard class loader to load Foo
! ClassLoader l = new PreemptingClassLoader("Task", "Foo", "I", "J");
! l.loadClass("Foo");
! l.loadClass("Task").newInstance();
! Task t = new Task();
try {
t.m(); // Should get AME
throw new RuntimeException("Missing AbstractMethodError exception");
} catch (AbstractMethodError e) {
! if (!e.getMessage().contains("Method Task.m()LFoo; is abstract")) {
throw new RuntimeException("Wrong AME exception thrown: " + e.getMessage());
}
}
}
--- 46,65 ----
// though it is inheriting the method from its super class C, and Task has
// a different class Foo than C, no LinkageError exception should be thrown
// because the loader constraint check that would cause the LinkageError
// should not be done.
public static void main(String args[]) throws Exception {
! Class<?> c = test.Foo.class; // forces standard class loader to load Foo
! ClassLoader l = new PreemptingClassLoader("test.Task", "test.Foo", "test.I", "test.J");
! l.loadClass("test.Foo");
! l.loadClass("test.Task").newInstance();
! test.Task t = new test.Task();
try {
t.m(); // Should get AME
throw new RuntimeException("Missing AbstractMethodError exception");
} catch (AbstractMethodError e) {
! if (!e.getMessage().contains("Method test/Task.m()Ltest/Foo; is abstract")) {
throw new RuntimeException("Wrong AME exception thrown: " + e.getMessage());
}
}
}
< prev index next >