Inference bug?

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Mar 19 04:01:27 PDT 2013


Are you using a recent compiler? This seems to work for me (I did some 
changes in this area).

Maurizio

On 18/03/13 16:17, Zhong Yu wrote:
> 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