Inference bug?
Zhong Yu
zhong.j.yu at gmail.com
Tue Mar 19 07:39:02 PDT 2013
On Tue, Mar 19, 2013 at 6:01 AM, Maurizio Cimadamore
<maurizio.cimadamore at oracle.com> wrote:
> Are you using a recent compiler? This seems to work for me (I did some
No, I'm just trying out http://jdk8.java.net/download.html
> 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