671 } |
671 } |
672 |
672 |
673 // in an anonymous class, add the set of thrown exceptions to |
673 // in an anonymous class, add the set of thrown exceptions to |
674 // the throws clause of the synthetic constructor and propagate |
674 // the throws clause of the synthetic constructor and propagate |
675 // outwards. |
675 // outwards. |
|
676 // Changing the throws clause on the fly is okay here because |
|
677 // the anonymous constructor can't be invoked anywhere else, |
|
678 // and its type hasn't been cached. |
676 if (tree.name == names.empty) { |
679 if (tree.name == names.empty) { |
677 for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { |
680 for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) { |
678 if (TreeInfo.isInitialConstructor(l.head)) { |
681 if (TreeInfo.isInitialConstructor(l.head)) { |
679 JCMethodDecl mdef = (JCMethodDecl)l.head; |
682 JCMethodDecl mdef = (JCMethodDecl)l.head; |
680 mdef.thrown = make.Types(thrown); |
683 mdef.thrown = make.Types(thrown); |
681 mdef.sym.type.setThrown(thrown); |
684 mdef.sym.type = types.createMethodTypeWithThrown(mdef.sym.type, thrown); |
682 } |
685 } |
683 } |
686 } |
684 thrownPrev = chk.union(thrown, thrownPrev); |
687 thrownPrev = chk.union(thrown, thrownPrev); |
685 } |
688 } |
686 |
689 |