SAM conversion of abstracted methods from java.lang.Object
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Aug 25 06:12:21 PDT 2010
On 25/08/10 13:54, Thomas Jung wrote:
> Hi,
>
> the SAM type conversion for a type A that abstracts a method from
> java.lang.Object
>
> abstract class A{
> @Override public abstract boolean equals(Object object);
> }
>
Hi,
the current definition of SAM conversion does not consider Object
methods as possible targets for lambda conversion.
Maurizio
> A a = #(x){true};
>
> does not compile with:
> invalid target type A for lambda conversion
> A a = #(x){true};
>
> The analogous definition for a method that is not defined in
> java.lang.Object works.
>
> C c = #{"y"};
>
> class B{
> String x(){ return "x"; }
> }
>
> abstract class C extends B{
> @Override abstract String x();
> }
>
> Thomas
>
>
More information about the lambda-dev
mailing list