-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
7, 8, 9
this code compiles since 7:
public void m(){
try{
System.out.println();
} catch (Throwable e) {
throw e ;
}
}
and this already not:
public void m(){
try{
if(false) throw new MyCheckedException();
} catch (Throwable e) {
throw e ;
}
}
public static class MyCheckedException extends Throwable {}
javac checks try body for code which contains statements(methods) with checked exceptions, if they doesn't contain this . But Exception table still contains Throwable:
public void m();
stack=1, locals=2, args_size=1
0: getstatic #5 // Field java/lang/System.out:Ljava/io/PrintStream;
3: invokevirtual #6 // Method java/io/PrintStream.println:()V
6: goto 12
9: astore_1
10: aload_1
11: athrow
12: return
Exception table:
from to target type
0 6 9 Class java/lang/Throwable
StackMapTable: number_of_entries = 2
frame_type = 73 /* same_locals_1_stack_item */
stack = [ class java/lang/Throwable ]
frame_type = 2 /* same */
public void m(){
try{
System.out.println();
} catch (Throwable e) {
throw e ;
}
}
and this already not:
public void m(){
try{
if(false) throw new MyCheckedException();
} catch (Throwable e) {
throw e ;
}
}
public static class MyCheckedException extends Throwable {}
javac checks try body for code which contains statements(methods) with checked exceptions, if they doesn't contain this . But Exception table still contains Throwable:
public void m();
stack=1, locals=2, args_size=1
0: getstatic #5 // Field java/lang/System.out:Ljava/io/PrintStream;
3: invokevirtual #6 // Method java/io/PrintStream.println:()V
6: goto 12
9: astore_1
10: aload_1
11: athrow
12: return
Exception table:
from to target type
0 6 9 Class java/lang/Throwable
StackMapTable: number_of_entries = 2
frame_type = 73 /* same_locals_1_stack_item */
stack = [ class java/lang/Throwable ]
frame_type = 2 /* same */
- relates to
-
JDK-6412514 Message "except.never.thrown.in.try" have to be reported in extra cases
- Closed