< prev index next >

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

Print this page
@@ -370,11 +370,11 @@
          }
  
          //create the method declaration hoisting the lambda body
          JCMethodDecl lambdaDecl = make.MethodDef(make.Modifiers(sym.flags_field),
                  sym.name,
-                 make.QualIdent(lambdaType.getReturnType().tsym),
+                 make.QualIdent(lambdaType.getReturnType().tsym).setType(lambdaType.getReturnType()),
                  List.nil(),
                  localContext.syntheticParams,
                  lambdaType.getThrownTypes() == null ?
                      List.nil() :
                      make.Types(lambdaType.getThrownTypes()),

@@ -519,10 +519,15 @@
          }
  
          List<JCExpression> indy_args = init==null? List.nil() : translate(List.of(init), localContext.prev);
  
  
+         if (refSym.isConstructor() && tree.expr.type.tsym == syms.objectType.tsym) {
+             if (tree.mode == ReferenceMode.NEW && tree.kind == ReferenceKind.TOPLEVEL) {
+                 refSym = rs.resolveInternalMethod(tree, attrEnv, syms.objectsType, names.newIdentity, List.nil(), List.nil());
+             }
+         }
          //build a sam instance using an indy call to the meta-factory
          result = makeMetafactoryIndyCall(localContext, refSym.asHandle(), indy_args);
      }
  
      /**

@@ -1853,11 +1858,11 @@
              /** does this functional expression require serialization support? */
              boolean isSerializable() {
                  if (forceSerializable) {
                      return true;
                  }
-                 return types.asSuper(tree.target, syms.serializableType.tsym) != null;
+                 return types.asSuper(tree.target.referenceProjectionOrSelf(), syms.serializableType.tsym) != null;
              }
  
              /**
               * @return Name of the enclosing method to be folded into synthetic
               * method name

@@ -2330,11 +2335,11 @@
                          (!nestmateLambdas && isPrivateInOtherClass()) ||
                          isProtectedInSuperClassOfEnclosingClassInOtherPackage(tree.sym, owner) ||
                          !receiverAccessible() ||
                          (tree.getMode() == ReferenceMode.NEW &&
                            tree.kind != ReferenceKind.ARRAY_CTOR &&
-                           (tree.sym.owner.isDirectlyOrIndirectlyLocal() || tree.sym.owner.isInner()));
+                           (tree.sym.owner.isDirectlyOrIndirectlyLocal() || tree.sym.owner.isInner() || tree.sym.owner.isValueClass()));
              }
  
              Type generatedRefSig() {
                  return types.erasure(tree.sym.type);
              }
< prev index next >