The following program should not compile because the exception caught
in the catch block cannot be thrown by the try block. javac 1.3 and
later fails to diagnose this problem. This is a regression from previous
versions of the compiler.
class T {
static class E extends Exception {}
public void t() throws E {}
void f() {
try {
try {
t();
} finally {
return;
}
} catch (E x) { // error: E can't be thrown in try block
}
}
}
in the catch block cannot be thrown by the try block. javac 1.3 and
later fails to diagnose this problem. This is a regression from previous
versions of the compiler.
class T {
static class E extends Exception {}
public void t() throws E {}
void f() {
try {
try {
t();
} finally {
return;
}
} catch (E x) { // error: E can't be thrown in try block
}
}
}