-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Description
Found a narrow usecase of moving a method to a superclass adding generic return type for Builder pattern.
Before:
- MyClass.java:
public class MyClass {
int blabla;
public MyClass withBlabla(int blibli) {
this.blabla = blibli;
return this;
}
}
After:
- MyClass.java:
public class MyClass extends ParentClass<MyClass> {
}
- ParentClass.java:
public class ParentClass<T extends ParentClass<T>> {
int blabla;
public T withBlabla(int blibli) {
this.blabla = blibli;
return (T) this;
}
}
When using the japicmp-maven-plugin against this change we get:
There is at least one incompatibility: blabla.MyClass.withBlabla(int):METHOD_REMOVED
Plugin config is:
<parameter>
<overrideCompatibilityChangeParameters>
<overrideCompatibilityChangeParameter>
<!-- Allow the adding of new method to interfaces -->
<compatibilityChange>METHOD_ADDED_TO_INTERFACE</compatibilityChange>
<binaryCompatible>true</binaryCompatible>
<sourceCompatible>true</sourceCompatible>
</overrideCompatibilityChangeParameter>
</overrideCompatibilityChangeParameters>
<breakBuildOnSourceIncompatibleModifications>true</breakBuildOnSourceIncompatibleModifications>
<breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
<!-- Allow new Maven API modules -->
<ignoreMissingOldVersion>true</ignoreMissingOldVersion>
<!-- Report only the failures in HTML report -->
<onlyModified>true</onlyModified>
<skipXmlReport>true</skipXmlReport>
<skipDiffReport>true</skipDiffReport>
</parameter>
All that is put together in this reproducer project:
Metadata
Metadata
Assignees
Labels
No labels