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

changeset 880
0c24826853b2
parent 878
fa0e4e1916f4
child 905
e9b8fbb30f5a
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Flow.java	Tue Feb 15 08:35:05 2011 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Feb 16 10:27:00 2011 -0800
     1.3 @@ -673,12 +673,15 @@
     1.4              // in an anonymous class, add the set of thrown exceptions to
     1.5              // the throws clause of the synthetic constructor and propagate
     1.6              // outwards.
     1.7 +            // Changing the throws clause on the fly is okay here because
     1.8 +            // the anonymous constructor can't be invoked anywhere else,
     1.9 +            // and its type hasn't been cached.
    1.10              if (tree.name == names.empty) {
    1.11                  for (List<JCTree> l = tree.defs; l.nonEmpty(); l = l.tail) {
    1.12                      if (TreeInfo.isInitialConstructor(l.head)) {
    1.13                          JCMethodDecl mdef = (JCMethodDecl)l.head;
    1.14                          mdef.thrown = make.Types(thrown);
    1.15 -                        mdef.sym.type.setThrown(thrown);
    1.16 +                        mdef.sym.type = types.createMethodTypeWithThrown(mdef.sym.type, thrown);
    1.17                      }
    1.18                  }
    1.19                  thrownPrev = chk.union(thrown, thrownPrev);

mercurial