Syntax for calling super

Jose A. Illescas jantonio.illescas at
Fri Aug 24 08:53:50 PDT 2012

Or use arrays,

   On multiple inheritance super can be an array of super interfaces (as 

then calling with

    super[K].m()      // on compile time K must be replaced with 
concrete index/position of K on "extends"

On 23/08/2012 10:42, John Hendrikx wrote:
>    On 23-8-2012 3:35, Brenden Towey wrote:
>> True.  In that case, I think I prefer your suggestion, super.K.m().
>> K.super.m() seems to be invoking the super-class of K, not of J. It's a
>> little confusing.  super.K.m() reads a bit more clearly. "my super
>> class" . "oh, this interface K though" . "m()"
> Another alternative might be to write it as:
> super(K).m();
> or even
> super(K.class).m();
> The general behaviour of super seems to be that it gives you a reference
> to the superclass.  If it is unclear which one it should 'return', then
> passing it a parameter seems fairly natural syntax.
>> I can see a case for a cast, but super.K.m() is a convenient shorthand.
>> Less typing (and less reading!) is sometimes the better option.
>> Something like ((K) super).m() is a bit unnecessarily long.
>> On 8/22/2012 6:28 PM, David Holmes wrote:
>>> On 23/08/2012 11:09 AM, Brenden Towey wrote:
>>>> On 8/22/2012 3:32 PM, Yuval Shavit wrote:
>>>>> To my mind, the syntax "should" be K.m() (without the super). That
>>>>> makes
>>>> I'd tend to agree, except for the problems you mention.  What about
>>>> "J.super.m()"?  "Don't call me call my parent class?"
>>>> interface J extends K {
>>>>        int m() default { return J.super.m(); }  // calls J's parent's m()
>>>> }
>>> The problem with that is that you need to be able to select from
>>> multiple parents, so the parent's type has to be in there somewhere.
>>> David

More information about the lambda-dev mailing list