Skip to content

False positive BC break when a method changes from abstract to default #411

@garydgregory

Description

@garydgregory

Hi All:

According to the JLS 13.4.16. abstract Methods:

Changing a method that is declared abstract to no longer be declared abstract does not break compatibility with pre-existing binaries.

But japicmp reports a break when this happens in Apache Commons Digester:

git clone https://github.com/apache/commons-digester.git
cd commons-digester
git checkout 338f5195f67ee4dd23492963bc15739fd4ae1e13
mvn clean package japicmp:cmp -DskipTests

yields:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.041 s
[INFO] Finished at: 2025-01-07T16:38:30-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.siom79.japicmp:japicmp-maven-plugin:0.23.0:cmp (default-cli) on project commons-digester3: There is at least one incompatibility: org.apache.commons.digester3.ObjectCreationFactory.getDigester():METHOD_ABSTRACT_NOW_DEFAULT,org.apache.commons.digester3.ObjectCreationFactory.setDigester(org.apache.commons.digester3.Digester):METHOD_ABSTRACT_NOW_DEFAULT -> [Help 1]

In this case, the change is from abstract to default in an interface.

Or am I missing something?

I am using:

openjdk version "17.0.13" 2024-10-15
OpenJDK Runtime Environment Homebrew (build 17.0.13+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.13+0, mixed mode, sharing)

Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /opt/homebrew/Cellar/maven/3.9.9/libexec
Java version: 17.0.13, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk@17/17.0.13/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "15.2", arch: "aarch64", family: "mac"

TY!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions