< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java

Print this page
@@ -2257,10 +2257,19 @@
                  //when 292 issue is fixed we should remove this and change the backend
                  //code to always generate a method handle to an accessible method
                  return tree.ownerAccessible;
              }
  
+             /* Per our interim inline class translation scheme, the reference projection classes
+                are completely empty, so we want the methods in the value class to be invoked instead.
+                As the lambda meta factory isn't clued into this, it will try to invoke the method in
+                C$ref.class and fail with a NoSuchMethodError. we need to workaround it ourselves.
+             */
+             boolean receiverIsReferenceProjection() {
+                 return tree.sym.kind == MTH && tree.sym.owner.isReferenceProjection();
+             }
+ 
              /**
               * This method should be called only when target release <= 14
               * where LambdaMetaFactory does not spin nestmate classes.
               *
               * This method should be removed when --release 14 is not supported.

@@ -2309,13 +2318,14 @@
                          needsVarArgsConversion() ||
                          isArrayOp() ||
                          (!nestmateLambdas && isPrivateInOtherClass()) ||
                          isProtectedInSuperClassOfEnclosingClassInOtherPackage(tree.sym, owner) ||
                          !receiverAccessible() ||
+                         receiverIsReferenceProjection() ||
                          (tree.getMode() == ReferenceMode.NEW &&
                            tree.kind != ReferenceKind.ARRAY_CTOR &&
-                           (tree.sym.owner.isLocal() || tree.sym.owner.isInner()));
+                           (tree.sym.owner.isLocal() || tree.sym.owner.isInner() || tree.sym.owner.isValue()));
              }
  
              Type generatedRefSig() {
                  return types.erasure(tree.sym.type);
              }
< prev index next >