Syntax for calling super

GREGG WONDERLY greggwon at
Wed Aug 22 18:48:09 PDT 2012

I am a bit worried about using "super".  Since we already have K.this.m() for qualifying which method to use in a subclass's reference to a super class named K, why would we add "super" to the mix?  I the graph of classes, when could "super" from the base interfaces's perspective, ever designate something that is hereditarily different from what 'this' means in the subclasses reference back up to some super class?


On Aug 22, 2012, at 8:35 PM, Brenden Towey <brendentowey at> 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()"
> 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