langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
changeset 29553 716d47f5a45e
parent 29552 690d0becaf32
child 29554 6d7957bd6866
equal deleted inserted replaced
29552:690d0becaf32 29553:716d47f5a45e
    38 import com.sun.tools.javac.code.*;
    38 import com.sun.tools.javac.code.*;
    39 import com.sun.tools.javac.code.Lint.LintCategory;
    39 import com.sun.tools.javac.code.Lint.LintCategory;
    40 import com.sun.tools.javac.code.Scope.WriteableScope;
    40 import com.sun.tools.javac.code.Scope.WriteableScope;
    41 import com.sun.tools.javac.code.Symbol.*;
    41 import com.sun.tools.javac.code.Symbol.*;
    42 import com.sun.tools.javac.code.Type.*;
    42 import com.sun.tools.javac.code.Type.*;
       
    43 import com.sun.tools.javac.code.Types.FunctionDescriptorLookupError;
    43 import com.sun.tools.javac.comp.Check.CheckContext;
    44 import com.sun.tools.javac.comp.Check.CheckContext;
    44 import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
    45 import com.sun.tools.javac.comp.DeferredAttr.AttrMode;
    45 import com.sun.tools.javac.comp.Infer.InferenceContext;
    46 import com.sun.tools.javac.comp.Infer.InferenceContext;
    46 import com.sun.tools.javac.comp.Infer.FreeTypeListener;
    47 import com.sun.tools.javac.comp.Infer.FreeTypeListener;
    47 import com.sun.tools.javac.jvm.*;
    48 import com.sun.tools.javac.jvm.*;
       
    49 import com.sun.tools.javac.resources.CompilerProperties.Fragments;
    48 import com.sun.tools.javac.tree.*;
    50 import com.sun.tools.javac.tree.*;
    49 import com.sun.tools.javac.tree.JCTree.*;
    51 import com.sun.tools.javac.tree.JCTree.*;
    50 import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
    52 import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
    51 import com.sun.tools.javac.util.*;
    53 import com.sun.tools.javac.util.*;
    52 import com.sun.tools.javac.util.DefinedBy.Api;
    54 import com.sun.tools.javac.util.DefinedBy.Api;
  2869                      */
  2871                      */
  2870                     ClassSymbol csym = types.makeFunctionalInterfaceClass(env,
  2872                     ClassSymbol csym = types.makeFunctionalInterfaceClass(env,
  2871                             names.empty, List.of(fExpr.targets.head), ABSTRACT);
  2873                             names.empty, List.of(fExpr.targets.head), ABSTRACT);
  2872                     if (csym != null) {
  2874                     if (csym != null) {
  2873                         chk.checkImplementations(env.tree, csym, csym);
  2875                         chk.checkImplementations(env.tree, csym, csym);
       
  2876                         try {
       
  2877                             //perform an additional functional interface check on the synthetic class,
       
  2878                             //as there may be spurious errors for raw targets - because of existing issues
       
  2879                             //with membership and inheritance (see JDK-8074570).
       
  2880                             csym.flags_field |= INTERFACE;
       
  2881                             types.findDescriptorType(csym.type);
       
  2882                         } catch (FunctionDescriptorLookupError err) {
       
  2883                             resultInfo.checkContext.report(fExpr,
       
  2884                                     diags.fragment(Fragments.NoSuitableFunctionalIntfInst(fExpr.targets.head)));
       
  2885                         }
  2874                     }
  2886                     }
  2875                 } catch (Types.FunctionDescriptorLookupError ex) {
  2887                 } catch (Types.FunctionDescriptorLookupError ex) {
  2876                     JCDiagnostic cause = ex.getDiagnostic();
  2888                     JCDiagnostic cause = ex.getDiagnostic();
  2877                     resultInfo.checkContext.report(env.tree, cause);
  2889                     resultInfo.checkContext.report(env.tree, cause);
  2878                 }
  2890                 }