Cyclic definition of overriding

Dan Smith daniel.smith at
Tue Jun 9 21:36:03 UTC 2015

> On Jun 9, 2015, at 2:41 PM, Maurizio Cimadamore <maurizio.cimadamore at> wrote:
> On 09/06/15 21:15, Dan Smith wrote:
>> The fact that inheritance depends on overriding is due to how default methods work: you don't inherit a default method if it has already been overridden.  But note the "already" -- there's some induction going on here, building up the members of all supertypes before we attempt to decide the members of a subtype.  The rules for subtypes depend only on what we already know about supertypes.
> I thought that membership/inheritance has always depended on overriding - i.e. a method m is inherited from a class C only if m is not overridden in some subclass of C. I think some rules along those lines were there even before default methods?

Yes, you're right, the old spec (e.g., JLS 7) claimed that you inherit things that "are neither overridden nor hidden by a declaration in the class".  This did not work very will with overriding by inherited members (e.g., an inherited class method that overrides a superinterface method), which was one of the motivations for revising this in JLS 8.


More information about the compiler-dev mailing list