Allow access to any super (diamond problem)

Howard Lovatt howard.lovatt at gmail.com
Sat May 15 19:32:14 PDT 2010


My apologies - I hadn't noticed section 4.1

On 16 May 2010 12:27, Brian Goetz <brian.goetz at oracle.com> wrote:
> I think you need to read the document more carefully.
>
> On 5/15/2010 10:25 PM, Howard Lovatt wrote:
>>
>> In the proposed extension method strawman there is no way to access
>> the super of an extension method. The classic example of this is the
>> diamond problem (in the examples below I have assumed that method
>> bodies are allowed - this is not part of the strawman):
>>
>>   interface Base { String m() { return "Base"; } }
>>   interface Left extends Base { String m() { return "Left"; } }
>>   interface Right extends Base { String m() { return "Right"; } }
>>   interface Derived extends Left, Right {}
>>
>> An instance of Derived needs to specify what m does (since it is
>> ambiguous), I suggest allowing a qualified super:
>>
>>   Derived d = new Derived() { public String m() { return Base.super.m(); }
>> };
>>
>> The qualifying syntax is<implemented interface>.super.<method name
>> and arguments>.
>>
>>   -- Howard.
>



-- 
  -- Howard.


More information about the lambda-dev mailing list