-
Bug
-
Resolution: Fixed
-
P4
-
8
-
b12
-
unknown
-
generic
-
Verified
(See http://stackoverflow.com/questions/6386917/strange-exception-table-entry-produced-by-suns-javac)
This program:
class Test {
public static void main(String[] args) {
try {
throw new NullPointerException();
} catch (NullPointerException npe) {
System.out.println("In catch");
} finally {
System.out.println("In finally");
}
}
}
Produces the following bytecode for method main:
0: new #2; // class NullPointerException
3: dup
4: invokespecial #3; // Method NullPointerException."<init>":()V
7: athrow
8: astore_1
9: getstatic #4; // Field System.out
12: ldc #5; // "In catch"
14: invokevirtual #6; // Method PrintStream.println
17: getstatic #4; // Field System.out
20: ldc #7; // String In finally
22: invokevirtual #6; // Method PrintStream.println
25: goto 39
28: astore_2
29: getstatic #4; // Field System.out
32: ldc #7; // "In finally"
34: invokevirtual #6; // Method PrintStream.println
37: aload_2
38: athrow
39: return
With the following exception table:
Exception table:
from to target type
0 8 8 Class NullPointerException
0 17 28 any
28 29 28 any
The last entry in the exception table appears to be bogus.
This program:
class Test {
public static void main(String[] args) {
try {
throw new NullPointerException();
} catch (NullPointerException npe) {
System.out.println("In catch");
} finally {
System.out.println("In finally");
}
}
}
Produces the following bytecode for method main:
0: new #2; // class NullPointerException
3: dup
4: invokespecial #3; // Method NullPointerException."<init>":()V
7: athrow
8: astore_1
9: getstatic #4; // Field System.out
12: ldc #5; // "In catch"
14: invokevirtual #6; // Method PrintStream.println
17: getstatic #4; // Field System.out
20: ldc #7; // String In finally
22: invokevirtual #6; // Method PrintStream.println
25: goto 39
28: astore_2
29: getstatic #4; // Field System.out
32: ldc #7; // "In finally"
34: invokevirtual #6; // Method PrintStream.println
37: aload_2
38: athrow
39: return
With the following exception table:
Exception table:
from to target type
0 8 8 Class NullPointerException
0 17 28 any
28 29 28 any
The last entry in the exception table appears to be bogus.