--- old/src/share/classes/com/sun/tools/javac/comp/Lower.java 2013-02-12 12:29:48.030212850 -0500 +++ new/src/share/classes/com/sun/tools/javac/comp/Lower.java 2013-02-12 12:29:47.822210685 -0500 @@ -1428,24 +1428,51 @@ return result; } - /** Definition for this$n field. - * @param pos The source code position of the definition. - * @param owner The class in which the definition goes. - */ - JCVariableDecl outerThisDef(int pos, Symbol owner) { - long flags = FINAL | SYNTHETIC; + private VarSymbol makeOuterThisVarSymbol(Symbol owner, long flags) { if (owner.kind == TYP && target.usePrivateSyntheticFields()) flags |= PRIVATE; Type target = types.erasure(owner.enclClass().type.getEnclosingType()); - VarSymbol outerThis = new VarSymbol( - flags, outerThisName(target, owner), target, owner); + VarSymbol outerThis = + new VarSymbol(flags, outerThisName(target, owner), target, owner); outerThisStack = outerThisStack.prepend(outerThis); - JCVariableDecl vd = make.at(pos).VarDef(outerThis, null); + return outerThis; + } + + private JCVariableDecl makeOuterThisVarDecl(int pos, VarSymbol sym) { + JCVariableDecl vd = make.at(pos).VarDef(sym, null); vd.vartype = access(vd.vartype); return vd; } + /** Definition for this$n field. + * @param pos The source code position of the definition. + * @param owner The method in which the definition goes. + */ + JCVariableDecl outerThisDef(int pos, MethodSymbol owner) { + ClassSymbol c = owner.enclClass(); + boolean isMandated = + // Anonymous constructors + (owner.isConstructor() && owner.isAnonymous()) || + // Constructors of non-private inner member classes + (owner.isConstructor() && c.isInner() && + !c.isPrivate() && !c.isStatic()); + long flags = + FINAL | (isMandated ? MANDATED : SYNTHETIC); + VarSymbol outerThis = makeOuterThisVarSymbol(owner, flags); + owner.extraParams = owner.extraParams.prepend(outerThis); + return makeOuterThisVarDecl(pos, outerThis); + } + + /** Definition for this$n field. + * @param pos The source code position of the definition. + * @param owner The class in which the definition goes. + */ + JCVariableDecl outerThisDef(int pos, ClassSymbol owner) { + VarSymbol outerThis = makeOuterThisVarSymbol(owner, FINAL | SYNTHETIC); + return makeOuterThisVarDecl(pos, outerThis); + } + /** Return a list of trees that load the free variables in given list, * in reverse order. * @param pos The source code position to be used for the trees. @@ -2551,7 +2578,6 @@ "enum" + target.syntheticNameChar() + "name"), syms.stringType, tree.sym); nameParam.mods.flags |= SYNTHETIC; nameParam.sym.flags_field |= SYNTHETIC; - JCVariableDecl ordParam = make. Param(names.fromString(target.syntheticNameChar() + "enum" + target.syntheticNameChar() + @@ -2562,6 +2588,8 @@ tree.params = tree.params.prepend(ordParam).prepend(nameParam); MethodSymbol m = tree.sym; + m.extraParams = m.extraParams.prepend(ordParam.sym); + m.extraParams = m.extraParams.prepend(nameParam.sym); Type olderasure = m.erasure(types); m.erasure_field = new MethodType( olderasure.getParameterTypes().prepend(syms.intType).prepend(syms.stringType),