--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Sat May 14 11:29:34 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon May 16 09:38:04 2011 +0100
@@ -1708,20 +1708,24 @@
// that we are referring to a superclass instance of the
// current instance (JLS ???).
else {
- localEnv.info.selectSuper = cdef != null;
- localEnv.info.varArgs = false;
+ //the following code alters some of the fields in the current
+ //AttrContext - hence, the current context must be dup'ed in
+ //order to avoid downstream failures
+ Env<AttrContext> rsEnv = localEnv.dup(tree);
+ rsEnv.info.selectSuper = cdef != null;
+ rsEnv.info.varArgs = false;
tree.constructor = rs.resolveConstructor(
- tree.pos(), localEnv, clazztype, argtypes, typeargtypes);
+ tree.pos(), rsEnv, clazztype, argtypes, typeargtypes);
tree.constructorType = tree.constructor.type.isErroneous() ?
syms.errType :
checkMethod(clazztype,
tree.constructor,
- localEnv,
+ rsEnv,
tree.args,
argtypes,
typeargtypes,
- localEnv.info.varArgs);
- if (localEnv.info.varArgs)
+ rsEnv.info.varArgs);
+ if (rsEnv.info.varArgs)
Assert.check(tree.constructorType.isErroneous() || tree.varargsElement != null);
}
@@ -1779,9 +1783,10 @@
// Reassign clazztype and recompute constructor.
clazztype = cdef.sym.type;
+ boolean useVarargs = tree.varargsElement != null;
Symbol sym = rs.resolveConstructor(
tree.pos(), localEnv, clazztype, argtypes,
- typeargtypes, true, tree.varargsElement != null);
+ typeargtypes, true, useVarargs);
Assert.check(sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous());
tree.constructor = sym;
if (tree.constructor.kind > ERRONEOUS) {
@@ -1794,7 +1799,7 @@
tree.args,
argtypes,
typeargtypes,
- localEnv.info.varArgs);
+ useVarargs);
}
}