src/share/classes/com/sun/tools/javac/comp/Flow.java

changeset 880
0c24826853b2
parent 878
fa0e4e1916f4
child 905
e9b8fbb30f5a
equal deleted inserted replaced
879:846d6644bb70 880:0c24826853b2
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

mercurial