Inference bug?

Zhong Yu zhong.j.yu at gmail.com
Mon Mar 18 09:17:43 PDT 2013


Given

    interface Foo<T extends Number>
    {
        T foo(T x);
    }

This compiles (b81)

    Foo<? extends Number> foo1 = x->x;

but these don't compile:

    Foo<?> foo2 = x->x;

error: incompatible types: cannot infer functional interface
descriptor for Foo<Object>

    Foo<? extends Runnable> foo3 = x->x;

error: incompatible types: cannot infer functional interface
descriptor for Foo<Runnable>

Are they compiler bugs? Or are they compliant to spec? Thanks

Zhong Yu


More information about the lambda-dev mailing list