< prev index next >
test/hotspot/jtreg/runtime/exceptionMsgs/AbstractMethodError/AbstractMethodErrorTest.java
Print this page
rev 49017 : 8197405: Improve messages of AbstractMethodErrors and IncompatibleClassChangeErrors.
Reviewed-by: coleenp, dholmes
rev 49018 : [mq]: EditsDavidII.patch
*** 39,49 ****
import sun.hotspot.WhiteBox;
import compiler.whitebox.CompilerWhiteBoxTest;
import java.lang.reflect.Method;
! // This test assembles an errornous installation of classes.
// First, compile the test by @compile. This results in a legal set
// of classes.
// Then, with jasm, generate incompatible classes that overwrite
// the class files in the build directory.
// Last, call the real test throwing an AbstractMethodError and
--- 39,49 ----
import sun.hotspot.WhiteBox;
import compiler.whitebox.CompilerWhiteBoxTest;
import java.lang.reflect.Method;
! // This test assembles an errorneous installation of classes.
// First, compile the test by @compile. This results in a legal set
// of classes.
// Then, with jasm, generate incompatible classes that overwrite
// the class files in the build directory.
// Last, call the real test throwing an AbstractMethodError and
*** 110,124 ****
}
} catch (NoSuchMethodException e) { }
}
private static String expectedErrorMessageAME1_1 =
! "Missing implementation of interface method " +
! "AME1_B.anAbstractMethod()Ljava/lang/String;";
private static String expectedErrorMessageAME1_2 =
"Receiver class AME1_E does not define or inherit an implementation of the " +
! "resolved method public abstract aFunctionOfMyInterface()Ljava/lang/String; of " +
"interface AME1_C.";
public static void test_ame1() {
AME1_B objectAbstract = new AME1_D();
AME1_C objectInterface = new AME1_D();
--- 110,124 ----
}
} catch (NoSuchMethodException e) { }
}
private static String expectedErrorMessageAME1_1 =
! "Missing implementation of resolved method abstract " +
! "anAbstractMethod()Ljava/lang/String; of abstract class AME1_B.";
private static String expectedErrorMessageAME1_2 =
"Receiver class AME1_E does not define or inherit an implementation of the " +
! "resolved method abstract aFunctionOfMyInterface()Ljava/lang/String; of " +
"interface AME1_C.";
public static void test_ame1() {
AME1_B objectAbstract = new AME1_D();
AME1_C objectInterface = new AME1_D();
*** 167,180 ****
throw new RuntimeException("Caught unexpected exception: " + e);
}
}
private static String expectedErrorMessageAME2_Interpreted =
! "Missing implementation of interface method AME2_A.aFunctionOfMyInterface()V";
private static String expectedErrorMessageAME2_Compiled =
"Receiver class AME2_C does not define or inherit an implementation of the resolved method " +
! "public abstract aFunctionOfMyInterface()V of interface AME2_A.";
public AbstractMethodErrorTest() throws InstantiationException, IllegalAccessException {
try {
AME2_B myAbstract = new ImplementsAllFunctions();
myAbstract.fun2();
--- 167,181 ----
throw new RuntimeException("Caught unexpected exception: " + e);
}
}
private static String expectedErrorMessageAME2_Interpreted =
! "Missing implementation of resolved method abstract " +
! "aFunctionOfMyInterface()V of interface AME2_A.";
private static String expectedErrorMessageAME2_Compiled =
"Receiver class AME2_C does not define or inherit an implementation of the resolved method " +
! "abstract aFunctionOfMyInterface()V of interface AME2_A.";
public AbstractMethodErrorTest() throws InstantiationException, IllegalAccessException {
try {
AME2_B myAbstract = new ImplementsAllFunctions();
myAbstract.fun2();
*** 236,246 ****
}
}
private static String expectedErrorMessageAME3_1 =
"Receiver class AME3_C does not define or inherit an implementation of the resolved method " +
! "public ma()V of class AME3_A. Selected method is public abstract AME3_B.ma()V.";
// Testing abstract class that extends a class that has an implementation.
// Loop so that method gets eventually compiled/osred.
public static void test_ame3_1() throws Exception {
AME3_A c = new AME3_C();
--- 237,247 ----
}
}
private static String expectedErrorMessageAME3_1 =
"Receiver class AME3_C does not define or inherit an implementation of the resolved method " +
! "ma()V of class AME3_A. Selected method is abstract AME3_B.ma()V.";
// Testing abstract class that extends a class that has an implementation.
// Loop so that method gets eventually compiled/osred.
public static void test_ame3_1() throws Exception {
AME3_A c = new AME3_C();
*** 265,276 ****
}
}
}
private static String expectedErrorMessageAME3_2 =
! "Receiver class AME3_C does not define or inherit an implementation of the resolved method " +
! "public abstract ma()V of abstract class AME3_B.";
// Testing abstract class that extends a class that has an implementation.
// Loop so that method gets eventually compiled/osred.
public static void test_ame3_2() throws Exception {
AME3_C c = new AME3_C();
--- 266,277 ----
}
}
}
private static String expectedErrorMessageAME3_2 =
! "Receiver class AME3_C does not define or inherit an implementation of " +
! "the resolved method abstract ma()V of abstract class AME3_B.";
// Testing abstract class that extends a class that has an implementation.
// Loop so that method gets eventually compiled/osred.
public static void test_ame3_2() throws Exception {
AME3_C c = new AME3_C();
*** 295,315 ****
}
}
}
private static String expectedErrorMessageAME4 =
! "Missing implementation of interface method AME4_B.ma()V";
// Testing abstract class that extends a class that has an implementation.
public static void test_ame4() throws Exception {
AME4_C c = new AME4_C();
AME4_D d = new AME4_D();
! AME4_E e = new AME4_E(); // Errornous.
AME4_A a;
try {
! // Test: calls errornous e.ma() in the last iteration.
final int iterations = 10;
for (int i = 0; i < iterations; i++) {
a = e;
if (i % 2 == 0 && i < iterations - 1) {
a = c;
--- 296,317 ----
}
}
}
private static String expectedErrorMessageAME4 =
! "Missing implementation of resolved method abstract ma()V of " +
! "abstract class AME4_B.";
// Testing abstract class that extends a class that has an implementation.
public static void test_ame4() throws Exception {
AME4_C c = new AME4_C();
AME4_D d = new AME4_D();
! AME4_E e = new AME4_E(); // Errorneous.
AME4_A a;
try {
! // Test: calls errorneous e.ma() in the last iteration.
final int iterations = 10;
for (int i = 0; i < iterations; i++) {
a = e;
if (i % 2 == 0 && i < iterations - 1) {
a = c;
*** 413,423 ****
}
}
private static String expectedErrorMessageAME6_ItableStub =
"Receiver class AME6_B does not define or inherit an implementation of the resolved" +
! " method public abstract mc()V of interface AME6_A.";
// -------------------------------------------------------------------------
// AbstractMethodErrors detected in itable stubs.
// Note: How can we verify that we really stepped through the itable stub?
// - Bimorphic inlining should not happen since we have no profiling data when
--- 415,425 ----
}
}
private static String expectedErrorMessageAME6_ItableStub =
"Receiver class AME6_B does not define or inherit an implementation of the resolved" +
! " method abstract mc()V of interface AME6_A.";
// -------------------------------------------------------------------------
// AbstractMethodErrors detected in itable stubs.
// Note: How can we verify that we really stepped through the itable stub?
// - Bimorphic inlining should not happen since we have no profiling data when
*** 497,507 ****
}
}
// Helper classes to test abstract method error.
//
! // Errornous versions of these classes are implemented in java
// assembler.
// -------------------------------------------------------------------------
// This error should be detected interpreted.
--- 499,509 ----
}
}
// Helper classes to test abstract method error.
//
! // Errorneous versions of these classes are implemented in java
// assembler.
// -------------------------------------------------------------------------
// This error should be detected interpreted.
*** 510,520 ****
//
// A C // interfaces
// | |
// B | // abstract class
// \ /
! // E // errornous class implementation lacks method C::aFunctionOfMyInterface
//
interface AME1_A {
public String firstFunctionOfMyInterface0();
--- 512,522 ----
//
// A C // interfaces
// | |
// B | // abstract class
// \ /
! // E // errorneous class implementation lacks method C::aFunctionOfMyInterface
//
interface AME1_A {
public String firstFunctionOfMyInterface0();
*** 624,634 ****
//
// A // an interface declaring aFunctionOfMyInterface()
// |
// B // an abstract class
// |
! // C // errornous implementation lacks method A::aFunctionOfMyInterface()
//
interface AME2_A {
public void aFunctionOfMyInterface();
}
--- 626,636 ----
//
// A // an interface declaring aFunctionOfMyInterface()
// |
// B // an abstract class
// |
! // C // errorneous implementation lacks method A::aFunctionOfMyInterface()
//
interface AME2_A {
public void aFunctionOfMyInterface();
}
*** 670,680 ****
//
// A // a class implementing m()
// |
// B // an abstract class defining m() abstract
// |
! // C // an errornous class lacking an implementation of m()
//
class AME3_A {
public void ma() {
System.out.print("A.ma() ");
}
--- 672,682 ----
//
// A // a class implementing m()
// |
// B // an abstract class defining m() abstract
// |
! // C // an errorneous class lacking an implementation of m()
//
class AME3_A {
public void ma() {
System.out.print("A.ma() ");
}
*** 699,709 ****
//
// A // A: a class implementing ma()
// |
// B // B: an abstract class defining ma() abstract
// / | \
! // C D E // E: an errornous class lacking an implementation of ma()
//
class AME4_A {
public void ma() {
System.out.print("A.ma() ");
}
--- 701,711 ----
//
// A // A: a class implementing ma()
// |
// B // B: an abstract class defining ma() abstract
// / | \
! // C D E // E: an errorneous class lacking an implementation of ma()
//
class AME4_A {
public void ma() {
System.out.print("A.ma() ");
}
*** 742,752 ****
// C D E \
// B // Bad class, missing method implementation.
//
// Test:
// - Call D.mc() / E.mc() / F.mc() several times to force real vtable call constrution
! // - Call errornous B.mc() in the end to raise the AbstraceMethodError
abstract class AME5_A {
abstract void ma();
abstract void mb();
abstract void mc();
--- 744,754 ----
// C D E \
// B // Bad class, missing method implementation.
//
// Test:
// - Call D.mc() / E.mc() / F.mc() several times to force real vtable call constrution
! // - Call errorneous B.mc() in the end to raise the AbstraceMethodError
abstract class AME5_A {
abstract void ma();
abstract void mb();
abstract void mc();
*** 820,830 ****
// C D E \
// B (bad class, missing method)
//
// Test:
// - Call D.mc() / E.mc() / F.mc() several times to force real itable call constrution
! // - Call errornous B.mc() in the end to raise the AbstraceMethodError
interface AME6_A {
abstract void ma();
abstract void mb();
abstract void mc();
--- 822,832 ----
// C D E \
// B (bad class, missing method)
//
// Test:
// - Call D.mc() / E.mc() / F.mc() several times to force real itable call constrution
! // - Call errorneous B.mc() in the end to raise the AbstraceMethodError
interface AME6_A {
abstract void ma();
abstract void mb();
abstract void mc();
< prev index next >