siom79 / japicmp

Comparison of two versions of a jar archive
https://siom79.github.io/japicmp
Apache License 2.0
712 stars 107 forks source link

Unexpected result when adding default to a base interface #276

Closed miKerscher closed 3 years ago

miKerscher commented 3 years ago

We have to following code in version 1.0.0:

interface A {
}

interface B extends A {
}

abstract class BAbstract  implements B {
}

class BImpl extends BAbstract {
}

In version 1.0.1 we add the method foo with a default implementation to A:

interface A {

   default void foo() {
       // ...
   }
}

japi-cmp produces the following incompatiblity:

JApiClass [fullyQualifiedName=BImpl, changeStatus=UNCHANGED, compatibilityChanges=[METHOD_ABSTRACT_ADDED_IN_IMPLEMENTED_INTERFACE]]

Expected is METHOD_DEFAULT_ADDED_IN_IMPLEMENTED_INTERFACE

The Problem does not occur when the version number is changed to 1.1.0

The bug can be produced in the github repo https://github.com/miKerscher/japi-cmp-repoduce-issue-276/ The master branch contains version 1.0.0 The branch dev-1.0.1 contains version 1.0.1

garydgregory commented 3 years ago

I've run into this many times as well, it is quite counterintuitive!

siom79 commented 3 years ago

Added new compatibilty change METHOD_DEFAULT_ADDED_IN_IMPLEMENTED_INTERFACE.

miKerscher commented 3 years ago

Thank you for your fast response. When will the new version with the fix be available?

siom79 commented 3 years ago

Released with 0.15.1