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 12:09:21 PDT 2010
I think this is a distinct problem as it is invalid in any case
(supporting java.lang.Object methods or not).
On 1 September 2010 20:08, Alex Buckley <alex.buckley at oracle.com> wrote:
> 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