1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Sat May 14 11:29:34 2011 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon May 16 09:38:04 2011 +0100 1.3 @@ -1708,20 +1708,24 @@ 1.4 // that we are referring to a superclass instance of the 1.5 // current instance (JLS ???). 1.6 else { 1.7 - localEnv.info.selectSuper = cdef != null; 1.8 - localEnv.info.varArgs = false; 1.9 + //the following code alters some of the fields in the current 1.10 + //AttrContext - hence, the current context must be dup'ed in 1.11 + //order to avoid downstream failures 1.12 + Env<AttrContext> rsEnv = localEnv.dup(tree); 1.13 + rsEnv.info.selectSuper = cdef != null; 1.14 + rsEnv.info.varArgs = false; 1.15 tree.constructor = rs.resolveConstructor( 1.16 - tree.pos(), localEnv, clazztype, argtypes, typeargtypes); 1.17 + tree.pos(), rsEnv, clazztype, argtypes, typeargtypes); 1.18 tree.constructorType = tree.constructor.type.isErroneous() ? 1.19 syms.errType : 1.20 checkMethod(clazztype, 1.21 tree.constructor, 1.22 - localEnv, 1.23 + rsEnv, 1.24 tree.args, 1.25 argtypes, 1.26 typeargtypes, 1.27 - localEnv.info.varArgs); 1.28 - if (localEnv.info.varArgs) 1.29 + rsEnv.info.varArgs); 1.30 + if (rsEnv.info.varArgs) 1.31 Assert.check(tree.constructorType.isErroneous() || tree.varargsElement != null); 1.32 } 1.33 1.34 @@ -1779,9 +1783,10 @@ 1.35 1.36 // Reassign clazztype and recompute constructor. 1.37 clazztype = cdef.sym.type; 1.38 + boolean useVarargs = tree.varargsElement != null; 1.39 Symbol sym = rs.resolveConstructor( 1.40 tree.pos(), localEnv, clazztype, argtypes, 1.41 - typeargtypes, true, tree.varargsElement != null); 1.42 + typeargtypes, true, useVarargs); 1.43 Assert.check(sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous()); 1.44 tree.constructor = sym; 1.45 if (tree.constructor.kind > ERRONEOUS) { 1.46 @@ -1794,7 +1799,7 @@ 1.47 tree.args, 1.48 argtypes, 1.49 typeargtypes, 1.50 - localEnv.info.varArgs); 1.51 + useVarargs); 1.52 } 1.53 } 1.54