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

2
  • Are you running this on a JVM that is from before the era of default interface methods? Commented Mar 1, 2021 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 Commented Mar 1, 2021 at 17:13

0