SAM type conversion does not take abstracted methods from java.lang.Object into account

Alex Buckley alex.buckley at oracle.com
Wed Sep 1 11:08:46 PDT 2010


Valid point but you raised it in a thread last week. Maurizio, Remi, and 
I all commented. Please respond in that thread.

Alex

On 9/1/2010 4:35 AM, Thomas Jung wrote:
> Hi,
> 
> the current implementation of the SAM type conversion does not take
> abstracted methods defined by java.lang.Object into account. A type
> that has two abstract methods (one an abstracted method from
> java.lang.Object) is still considered a SAM type.
> 
> interface A{
> 	void a();
> }
> 
> abstract static class B implements A{
> 	@Override public abstract boolean equals(Object object);
> }
> 
> abstract static class C implements A{
> 	@Override public abstract int hashCode();
> }
> 
> 
> B b = #{};
> C c = #{};  //should be a compiler error
> B b = #{};  //should be a compiler error
> 
> Thomas
> 


More information about the lambda-dev mailing list