valid SAM type not accepted
Mark Mahieu
markmahieu at gmail.com
Wed Nov 10 17:59:29 PST 2010
Maurizio,
Dunno if this is of any use to you, but I think I've just tickled the same (or a similar) bug with a slightly different example, which reduces to:
class DoubleVision {
interface A extends Runnable {}
interface B extends A, Runnable {}
B b = #{};
}
$ javac DoubleVision.java
DoubleVision.java:6: invalid target type B for lambda conversion
B b = #{};
^
reason: the target type of a lambda conversion has multiple non-overriding abstract methods
1 error
Mark
On 27 Oct 2010, at 21:01, maurizio cimadamore wrote:
> Could you point me to the definition of the Ordering class?
>
> Is it this?
>
> http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/Ordering.html
>
> Maurizio
>
>
> On 27/10/2010 20:37, Thomas Jung wrote:
>> Hi,
>>
>> I tried to convert my lambda examples to the new syntax and got the
>> following error with the latest changes:
>>
>> class X<T>{
>> private Ordering<T> x = new Ordering<T>(){ public int compare(T
>> left, T right) { return 0; }}; //as documentation
>> private Ordering<T> y = #{l, r -> 0 };
>> }
>>
>> X.java:8: invalid target type Ordering<T> for lambda conversion
>> private Ordering<T> y = #{l, r -> 0 }; ^
>> reason: the target type of a lambda conversion has multiple
>> non-overriding abstract methods
>> where T is a type-variable:
>> T extends Object declared in class X
>>
>> I hope it’s not a dump error.
>>
>> Thomas
>>
>
>
More information about the lambda-dev
mailing list