valid SAM type not accepted
Thomas Jung
thomas.andreas.jung at googlemail.com
Wed Oct 27 12:37:21 PDT 2010
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