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

changeset 1843
be62183f938a
parent 1826
9851071b551a
child 1844
29dcd6715b04
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Tue Jun 18 20:56:04 2013 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Jun 19 11:48:05 2013 +0100
     1.3 @@ -2267,6 +2267,24 @@
     1.4          c.flags_field |= ACYCLIC;
     1.5      }
     1.6  
     1.7 +    /**
     1.8 +     * Check that functional interface methods would make sense when seen
     1.9 +     * from the perspective of the implementing class
    1.10 +     */
    1.11 +    void checkFunctionalInterface(JCTree tree, Type funcInterface) {
    1.12 +        ClassType c = new ClassType(Type.noType, List.<Type>nil(), null);
    1.13 +        ClassSymbol csym = new ClassSymbol(0, names.empty, c, syms.noSymbol);
    1.14 +        c.interfaces_field = List.of(types.removeWildcards(funcInterface));
    1.15 +        c.supertype_field = syms.objectType;
    1.16 +        c.tsym = csym;
    1.17 +        csym.members_field = new Scope(csym);
    1.18 +        Symbol descSym = types.findDescriptorSymbol(funcInterface.tsym);
    1.19 +        Type descType = types.findDescriptorType(funcInterface);
    1.20 +        csym.members_field.enter(new MethodSymbol(PUBLIC, descSym.name, descType, csym));
    1.21 +        csym.completer = null;
    1.22 +        checkImplementations(tree, csym, csym);
    1.23 +    }
    1.24 +
    1.25      /** Check that all methods which implement some
    1.26       *  method conform to the method they implement.
    1.27       *  @param tree         The class definition whose members are checked.

mercurial