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

Thomas Jung thomas.andreas.jung at googlemail.com
Wed Sep 1 04:35:52 PDT 2010


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