src/share/classes/com/sun/tools/javac/comp/Attr.java

changeset 2428
ce1d9dd2e9eb
parent 2425
76b61848c9a4
child 2525
2eb010b6cb22
child 2543
c6d5efccedc3
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Jun 18 10:44:16 2014 +0200
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jun 19 15:39:37 2014 +0100
     1.3 @@ -2968,10 +2968,19 @@
     1.4              if (checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK &&
     1.5                      pt != Type.recoveryType) {
     1.6                  //check that functional interface class is well-formed
     1.7 -                ClassSymbol csym = types.makeFunctionalInterfaceClass(env,
     1.8 -                        names.empty, List.of(fExpr.targets.head), ABSTRACT);
     1.9 -                if (csym != null) {
    1.10 -                    chk.checkImplementations(env.tree, csym, csym);
    1.11 +                try {
    1.12 +                    /* Types.makeFunctionalInterfaceClass() may throw an exception
    1.13 +                     * when it's executed post-inference. See the listener code
    1.14 +                     * above.
    1.15 +                     */
    1.16 +                    ClassSymbol csym = types.makeFunctionalInterfaceClass(env,
    1.17 +                            names.empty, List.of(fExpr.targets.head), ABSTRACT);
    1.18 +                    if (csym != null) {
    1.19 +                        chk.checkImplementations(env.tree, csym, csym);
    1.20 +                    }
    1.21 +                } catch (Types.FunctionDescriptorLookupError ex) {
    1.22 +                    JCDiagnostic cause = ex.getDiagnostic();
    1.23 +                    resultInfo.checkContext.report(env.tree, cause);
    1.24                  }
    1.25              }
    1.26          }

mercurial