-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b142
-
unknown
-
generic
-
Verified
This idiom causes warnings to be generated with latest javac:
try {
task.run();
} catch (RuntimeException x) {
thrown = x; throw x;
} catch (Error x) {
thrown = x; throw x;
} catch (Throwable x) {
thrown = x; throw new Error(x);
} finally {
afterExecute(task, thrown);
}
This is a frequent idiom in the JDK - note that the last catch clause is not entirely redundant as it can catch checked exceptions coming from a Class.newInstance call (which is transparent w.r.t. exceptions in the constructor).
try {
task.run();
} catch (RuntimeException x) {
thrown = x; throw x;
} catch (Error x) {
thrown = x; throw x;
} catch (Throwable x) {
thrown = x; throw new Error(x);
} finally {
afterExecute(task, thrown);
}
This is a frequent idiom in the JDK - note that the last catch clause is not entirely redundant as it can catch checked exceptions coming from a Class.newInstance call (which is transparent w.r.t. exceptions in the constructor).
- relates to
-
JDK-6558548 The compiler needs to be aligned with clarified specification of throws
-
- Closed
-