1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java Fri Apr 29 16:05:02 2011 +0100 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java Fri Apr 29 16:05:29 2011 +0100 1.3 @@ -1153,8 +1153,7 @@ 1.4 if (chk.subset(exc, caughtInTry)) { 1.5 log.error(pos, "except.already.caught", exc); 1.6 } else if (!chk.isUnchecked(pos, exc) && 1.7 - exc.tsym != syms.throwableType.tsym && 1.8 - exc.tsym != syms.exceptionType.tsym && 1.9 + !isExceptionOrThrowable(exc) && 1.10 !chk.intersects(exc, thrownInTry)) { 1.11 log.error(pos, "except.never.thrown.in.try", exc); 1.12 } else if (allowImprovedCatchAnalysis) { 1.13 @@ -1163,7 +1162,8 @@ 1.14 // unchecked exception, the result list would not be empty, as the augmented 1.15 // thrown set includes { RuntimeException, Error }; if 'exc' was a checked 1.16 // exception, that would have been covered in the branch above 1.17 - if (chk.diff(catchableThrownTypes, caughtInTry).isEmpty()) { 1.18 + if (chk.diff(catchableThrownTypes, caughtInTry).isEmpty() && 1.19 + !isExceptionOrThrowable(exc)) { 1.20 String key = catchableThrownTypes.length() == 1 ? 1.21 "unreachable.catch" : 1.22 "unreachable.catch.1"; 1.23 @@ -1171,6 +1171,12 @@ 1.24 } 1.25 } 1.26 } 1.27 + //where 1.28 + private boolean isExceptionOrThrowable(Type exc) { 1.29 + return exc.tsym == syms.throwableType.tsym || 1.30 + exc.tsym == syms.exceptionType.tsym; 1.31 + } 1.32 + 1.33 1.34 public void visitConditional(JCConditional tree) { 1.35 scanCond(tree.cond);