Syntax for calling super

Brian Goetz brian.goetz at oracle.com
Wed Aug 22 18:45:33 PDT 2012


> interface J extends K {
>      int m() default { return J.super.m(); }  // calls J's parent's m()
> }

Compilation error.

The interface before the ".super" must be (a) an immediate 
superinterface and (b) must be an interface from which this class could 
inherit an implementation of m().  In other words, this interface must 
(be allowed to) directly override the method m() being super-called too. 
  (See the "Featherweight Defenders" model for precise semantics.)


More information about the lambda-dev mailing list