langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java
changeset 8430 be3e5581ea25
parent 8428 1e9935b883cd
child 8626 38b24af530bc
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Tue Feb 15 08:35:05 2011 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Feb 16 10:27:00 2011 -0800
@@ -673,12 +673,15 @@
             // in an anonymous class, add the set of thrown exceptions to
             // the throws clause of the synthetic constructor and propagate
             // outwards.
+            // Changing the throws clause on the fly is okay here because
+            // the anonymous constructor can't be invoked anywhere else,
+            // and its type hasn't been cached.
             if (tree.name == names.empty) {
                 for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
                     if (TreeInfo.isInitialConstructor(l.head)) {
                         JCMethodDecl mdef = (JCMethodDecl)l.head;
                         mdef.thrown = make.Types(thrown);
-                        mdef.sym.type.setThrown(thrown);
+                        mdef.sym.type = types.createMethodTypeWithThrown(mdef.sym.type, thrown);
                     }
                 }
                 thrownPrev = chk.union(thrown, thrownPrev);