valid SAM type not accepted

maurizio cimadamore maurizio.cimadamore at oracle.com
Wed Oct 27 13:01:07 PDT 2010


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