Default method implementation to override abstract method
<p>The following is not allowed in Java-8:</p>

<pre><code>public interface Operator {
    default String call() throws Exception {
      // do some default things
      return performOperation();
    }

    String performOperation();
}

public abstract class AbstractTestClass {
    public abstract String call() throws Exception;
}

public class TestClass extends AbstractTestClass implements Operator {
    @Override
    public String performOperation() {
      // do some operation
    }
}
</code></pre>

<p>The above fails to compile with the error message saying that the <code>TestClass</code> needs to be either abstract or override the call method.</p>

<p>I was thinking that the default method could provide the necessary override. Why does that not work?</p>

<p>I am forced to do something like the following:</p>

<pre><code>public interface Operator {
    default String doCall() throws Exception {
      // do some default things
      return performOperation();
    }

    String performOperation();
}

public abstract class AbstractTestClass {
    public abstract String call() throws Exception;
}

public class TestClass extends AbstractTestClass implements Operator {
    String call() throws Exception {
      doCall();
    }

    @Override
    public String performOperation() {
      // do some operation
    }
}
</code></pre>

<p>This is lacking the clean design that I am looking for.</p>

<p>I see over in <a href="https://stackoverflow.com/questions/41028840/can-a-default-method-implementation-be-used-to-implement-an-abstract-method-in-a">this</a> question the solution is to do: </p>

<pre><code>public class TestClass extends AbstractTestClass implements Operator {
    String call() throws Exception {
      Operator.super.call();
    }

    @Override
    public String performOperation() {
      // do some operation
    }
}
</code></pre>

<p>However, the solution does not explain why the compiler does not allow the above clean design. I would like to understand the reasonining and also, see if there is a way I can hide the <code>call</code> method in the <code>TestClass</code>.</p>