Raffi Khatchadourian Raffi Khatchadourian - 11 months ago 40
Java Question

Why can't I reference super in a default method in Java 8 enhanced interfaces?

It seems that all references to

are disallowed in interfaces, which would include default methods of enhanced interfaces. If the interface extends another interface and the default method overrides another default method in that interface, wouldn't it be conceivable that I may have a use case to call the overridden method?

Answer Source

Because interfaces allow for multiple inheritance. Allowing for super in default implementations would therefore introduce the famous diamond problem (see eg. http://www.programmerinterview.com/index.php/c-cplusplus/diamond-problem/).