lambda in result expression of explicitly typed lambda

Anna Kozlova anna.kozlova at
Thu Feb 12 19:51:14 UTC 2015


Consider the following code:
         Supplier<Runnable > x = foo (() ->  () -> {});

    static <T> Supplier<T> foo(Supplier<T> delegate) {
        return null;

At the applicability check phase I expect B2 to contain <() -> {} -> T>,  and according to 18.2.1 it reduces to false ("If T is not a functional interface type (§9.8), the constraint reduces to false").
However 8u40 b23 compiles the code just fine, but why? 

Thank you,

More information about the compiler-dev mailing list