Call SuperInterface default method from overriding method in class implementing SubInterface
<pre><code>package org.my.site;

interface BaseInterface {
    default void f() {
        System.out.println("default Base.f()");
    }
}

interface DerivedInterface extends BaseInterface {
//  default void f() {
//      System.out.println("default Derived.f()");
//  }
}

public class DefaultExample implements DerivedInterface {

    @Override
    public void f() {

        DerivedInterface.super.f();
    }

    public static void main(String[] args) {
        new DefaultExample().f();
    }
}
</code></pre>

<p>While there is no overriding default method in DerivedInterface (so it is commented as in code snippet above) the output is:</p>

<pre><code>default Base.f()
</code></pre>

<p>But if I uncomment and default method f() is given new code in DerivedInterface, then the line "DerivedInterface.super.f();" works differently. The output is:</p>

<pre><code>default Derived.f()
</code></pre>

<p>Why? And can I access BaseInterface.f() from my class? I was able to do it until I redefined it...</p>

<p>Besides, I do not exactly understand how "DerivedInterface.super.f();" line works and why "super" (DerivedInterface.super.) works...</p>

<p>And is it true that I cannot refer to BaseInterface from my class? I mean that line "BaseInterface.super.f();" gives error "Cannot bypass the more specific direct supertype DerivedInterface".</p>

<p>In this <a href="https://stackoverflow.com/questions/22913784/is-calling-a-superinterfaces-default-method-possible">answer</a> it says how to call interface default method from overriding method in class (but there the hierarchy is simple: class extends interface). In my code line "BaseInterface.super.f();" gives error "Cannot bypass the more specific direct supertype DerivedInterface".</p>

<p>In another <a href="https://zeroturnaround.com/rebellabs/java-8-explained-default-methods/" rel="nofollow noreferrer">article</a> (its section "Multiple inheritance?") it is all about situation when 2 different interfaces (which do not extend each other - no hierarchy!) are simultaneously implemented by one class (then I1.super.f() and I2.super.f() work from within code of overriding f() method in class). My case is different because I2 extends I1 and class implements I2 only. So I1.super.f() gives error!</p>