Syntax for calling super

Brian Goetz brian.goetz at
Mon Aug 27 07:20:28 PDT 2012

>>> K.super.m() already has an existing meaning with inner classes, just as
>>> K.this.m() does. There's a difference between searching for a type alone
>>> and searching for an object and then a type. Using the same notation is
>>> confusing in my view.
>> Oh, I wasn't aware of that. That changes things.

The EG *was* aware of that, but decided K.super.m() was still the 
superior choice despite the theoretical conflict.  In particular:

  - Using this syntax for super-calls to defaults will not change the 
meaning of any existing code, since all existing code that uses 
ClassName.super.m() would use it with a class, not an interface, and 
there currently are no existing such super-calls in interfaces (since 
there is currently no method bodies in interfaces.)

  - The "old" syntax is so rarely used that almost no one even knows 
about it.  In informal inquiries, most people we showed it to said 
"that's not legal code."  (Most people here didn't know about it either.)

  - Conflicts are expected to be so rare that we didn't think it was 
worth choosing a lesser syntax for something that may actually be common.

As I've said, if someone comes up with something that is "obviously 
better", we'll consider it.  (But please, "obviously better" is a pretty 
high bar, so let's not paint a bikeshed that's already been painted.)

More information about the lambda-dev mailing list