src/share/classes/com/sun/tools/javac/code/Types.java

changeset 1497
7aa2025bbb7b
parent 1452
de1ec6fc93fe
child 1510
7873d37f5b37
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Wed Jan 16 16:27:01 2013 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Wed Jan 16 16:30:11 2013 +0000
     1.3 @@ -392,9 +392,9 @@
     1.4           * Compute the function descriptor associated with a given functional interface
     1.5           */
     1.6          public FunctionDescriptor findDescriptorInternal(TypeSymbol origin, CompoundScope membersCache) throws FunctionDescriptorLookupError {
     1.7 -            if (!origin.isInterface()) {
     1.8 +            if (!origin.isInterface() || (origin.flags() & ANNOTATION) != 0) {
     1.9                  //t must be an interface
    1.10 -                throw failure("not.a.functional.intf");
    1.11 +                throw failure("not.a.functional.intf", origin);
    1.12              }
    1.13  
    1.14              final ListBuffer<Symbol> abstracts = ListBuffer.lb();
    1.15 @@ -406,13 +406,13 @@
    1.16                      abstracts.append(sym);
    1.17                  } else {
    1.18                      //the target method(s) should be the only abstract members of t
    1.19 -                    throw failure("not.a.functional.intf.1",
    1.20 +                    throw failure("not.a.functional.intf.1",  origin,
    1.21                              diags.fragment("incompatible.abstracts", Kinds.kindName(origin), origin));
    1.22                  }
    1.23              }
    1.24              if (abstracts.isEmpty()) {
    1.25                  //t must define a suitable non-generic method
    1.26 -                throw failure("not.a.functional.intf.1",
    1.27 +                throw failure("not.a.functional.intf.1", origin,
    1.28                              diags.fragment("no.abstracts", Kinds.kindName(origin), origin));
    1.29              } else if (abstracts.size() == 1) {
    1.30                  return new FunctionDescriptor(abstracts.first());

mercurial