diff -r d57378c34fdb -r 09eb1acc9610 src/share/classes/com/sun/tools/javac/comp/Flow.java --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java Tue Jan 13 13:28:20 2009 +0000 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java Tue Jan 13 13:28:42 2009 +0000 @@ -1136,11 +1136,32 @@ scanExpr(tree.encl); scanExprs(tree.args); // scan(tree.def); - for (List l = tree.constructor.type.getThrownTypes(); + for (List l = tree.constructorType.getThrownTypes(); l.nonEmpty(); - l = l.tail) + l = l.tail) { markThrown(tree, l.head); - scan(tree.def); + } + List caughtPrev = caught; + try { + // If the new class expression defines an anonymous class, + // analysis of the anonymous constructor may encounter thrown + // types which are unsubstituted type variables. + // However, since the constructor's actual thrown types have + // already been marked as thrown, it is safe to simply include + // each of the constructor's formal thrown types in the set of + // 'caught/declared to be thrown' types, for the duration of + // the class def analysis. + if (tree.def != null) + for (List l = tree.constructor.type.getThrownTypes(); + l.nonEmpty(); + l = l.tail) { + caught = chk.incl(l.head, caught); + } + scan(tree.def); + } + finally { + caught = caughtPrev; + } } public void visitNewArray(JCNewArray tree) {