langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
changeset 28452 6afa05455443
parent 28145 365419055307
child 28453 9b94e84322e4
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Tue Jan 13 10:17:25 2015 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Tue Jan 13 10:25:24 2015 +0100
@@ -263,7 +263,7 @@
     @Override
     public void visitLambda(JCLambda tree) {
         LambdaTranslationContext localContext = (LambdaTranslationContext)context;
-        MethodSymbol sym = (MethodSymbol)localContext.translatedSym;
+        MethodSymbol sym = localContext.translatedSym;
         MethodType lambdaType = (MethodType) sym.type;
 
         {
@@ -1755,7 +1755,7 @@
             Map<LambdaSymbolKind, Map<Symbol, Symbol>> translatedSymbols;
 
             /** the synthetic symbol for the method hoisting the translated lambda */
-            Symbol translatedSym;
+            MethodSymbol translatedSym;
 
             List<JCVariableDecl> syntheticParams;
 
@@ -1997,6 +1997,7 @@
 
                 //compute synthetic params
                 ListBuffer<JCVariableDecl> params = new ListBuffer<>();
+                ListBuffer<VarSymbol> parameterSymbols = new ListBuffer<>();
 
                 // The signature of the method is augmented with the following
                 // synthetic parameters:
@@ -2005,19 +2006,16 @@
                 // 2) enclosing locals captured by the lambda expression
                 for (Symbol thisSym : getSymbolMap(CAPTURED_VAR).values()) {
                     params.append(make.VarDef((VarSymbol) thisSym, null));
-                }
-                if (methodReferenceReceiver != null) {
-                    params.append(make.VarDef(
-                            make.Modifiers(PARAMETER|FINAL),
-                            names.fromString("$rcvr$"),
-                            make.Type(methodReferenceReceiver.type),
-                            null));
+                    parameterSymbols.append((VarSymbol) thisSym);
                 }
                 for (Symbol thisSym : getSymbolMap(PARAM).values()) {
                     params.append(make.VarDef((VarSymbol) thisSym, null));
+                    parameterSymbols.append((VarSymbol) thisSym);
                 }
                 syntheticParams = params.toList();
 
+                translatedSym.params = parameterSymbols.toList();
+
                 // Compute and set the lambda name
                 translatedSym.name = isSerializable()
                         ? serializedLambdaName()