Consider this interface:
@Unstable
interface Foo {
default void one() {
... do something
}
void two();
}
and an implementing class
class Bar implements Foo {
void two() {
... do something else
}
}
(@Unstable is an annotation that we ignore for japicmp using @Unstable in the exclude config for the maven plugin).
We shipped this code for a while. It turns out that the "One" default method needs to go away. removing it, results in
WARNING: Incompatibility detected: Requires semantic version level MAJOR: JApiMethod [oldMethod=Bar.one(), newMethod=n.a., returnType=JApiReturnType [oldReturnTypeOptional=void, newReturnTypeOptional=void, changeStatus=REMOVED], getCompatibilityChanges()=[JApiCompatibilityChange{type=METHOD_REMOVED}]]
(or similar).
That was surprising. My assumption was, because the "Foo" interface is unstable and the method is not overridden in the implementing class, removing it would be no problem.
Adding the @Unstable annotation temporarily to class Bar is worse, because now the class "disappears" from the japicmp run and I get different errors.
Is this "works as designed"? How do I mark an interface default method in an unstable interface so that I can actually remove it without breaking japicmp?
Consider this interface:
and an implementing class
(
@Unstableis an annotation that we ignore for japicmp using@Unstablein the exclude config for the maven plugin).We shipped this code for a while. It turns out that the "One" default method needs to go away. removing it, results in
WARNING: Incompatibility detected: Requires semantic version level MAJOR: JApiMethod [oldMethod=Bar.one(), newMethod=n.a., returnType=JApiReturnType [oldReturnTypeOptional=void, newReturnTypeOptional=void, changeStatus=REMOVED], getCompatibilityChanges()=[JApiCompatibilityChange{type=METHOD_REMOVED}]](or similar).
That was surprising. My assumption was, because the "Foo" interface is unstable and the method is not overridden in the implementing class, removing it would be no problem.
Adding the
@Unstableannotation temporarily toclass Baris worse, because now the class "disappears" from the japicmp run and I get different errors.Is this "works as designed"? How do I mark an interface default method in an unstable interface so that I can actually remove it without breaking japicmp?