Name: akC45999 Date: 08/20/98
The attached test shows that the code fragment
try {
invokestatic01801a.run();
} catch (Error e) {
cannot catch ExceptionInInitializerError if JIT is on.
------------------------------------- file invokestatic01801.java
// modified version of the test
// javasoft.sqe.tests.vm.invokestatic.invokestatic018.invokestatic01801;
import java.io.PrintStream;
class invokestatic01801a {
static int i1 = invokestatic01801.i1;
static int i2 = invokestatic01801.i1;
static {
i1 = i1 / (i2 - i1);
}
public static void run () {
}
}
public class invokestatic01801 {
static int i1 = 1;
static int i2 = 1;
public static int run (String argv[], java.io.PrintStream out) {
try {
invokestatic01801a.run();
} catch (Error e) {
out.println("OK 1:"+e);
try {
invokestatic01801a.run();
} catch (NoClassDefFoundError ee) {
out.println("OK 2:"+ee);
return 0/*STATUS_PASSED*/;
} catch (Throwable ee) {
out.println("BAD 2: Throwable:"+e);
return 2/*STATUS_FAILED*/;
}
out.println("BAD 2: no exception");
return 2/*STATUS_FAILED*/;
} catch (Throwable e) {
out.println("BAD 1: Throwable:"+e);
return 2/*STATUS_FAILED*/;
}
out.println("BAD 1: no exception");
return 2/*STATUS_FAILED*/;
}
public static void main(String argv[]) {
try {
System.exit(run(argv,System.out)+95/*STATUS_TEMP*/);
} catch (Throwable e) {
System.out.println("exception in run():"+e);
}
}
}
------------------------------------- end of file invokestatic01801.java
Running the test with JIT:
novo64% java -fullversion
java full version "JDK-1.2fcs-F"
novo64% javac invokestatic01801.java
novo64% setenv CLASSPATH .
novo64% java invokestatic01801
exception in run():java.lang.ExceptionInInitializerError
novo64%
Running the test without JIT:
novo64% setenv JAVA_COMPILER m
novo64% java invokestatic01801
Warning: JIT compiler "m" not found. Will use interpreter.
OK 1:java.lang.ExceptionInInitializerError
OK 2:java.lang.NoClassDefFoundError: invokestatic01801a
novo64%
======================================================================
- duplicates
-
JDK-4165973 Attempt to read inaccessible property can produce exception of the wrong type.
-
- Closed
-