Allow access to any super (diamond problem)
Brian Goetz
brian.goetz at oracle.com
Sat May 15 19:27:12 PDT 2010
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.
More information about the lambda-dev
mailing list