2

I have an existing interface:

interface MyInterface {
    void methodA();
    void methodB();
}

I made methodB default and added a default implementation:

interface MyInterface {
    void methodA;
    default void methodB() {
    }
}

Suddently, some of the system that uses MyInterface starts to show ClassNotFoundException when they start use the new version of MyInterface.

I am worrying if my change could potentially break backward compatibility. Can someone please advise

ZZZ
  • 645
  • 4
  • 17
  • Are you running this on a JVM that is from before the era of default interface methods? – Federico klez Culloca Mar 01 '21 at 17:13
  • 1
    The change to a default method probably didn't cause a ClassNotFoundException, there were likely problems there already. A change to default method can cause an IncompatibleClassChangeError as has been discussed [here](https://stackoverflow.com/questions/31578427/what-is-the-purpose-of-the-default-keyword-in-java) – Charlie Armstrong Mar 01 '21 at 17:13

0 Answers0