valid SAM type not accepted

Thomas Jung thomas.andreas.jung at googlemail.com
Wed Oct 27 13:12:21 PDT 2010


Oh sorry Maurizio. I removed this line: import com.google.common.collect.*;

Yes, it is from

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>r06</version>
</dependency>

Thomas


On 27 October 2010 22:01, maurizio cimadamore
<maurizio.cimadamore at oracle.com> 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