Skip to content

classes that implement an interface but are missing required methods are not caught by missinglink #22

@mattnworb

Description

@mattnworb

Inspired by another real-world case of shooting myself in the foot:

  • library A contains an interface (Metrics)
  • library B contains an implementation of that interface (FooMetrics)
  • an update to library A adds a new method to the interface

If a project using A and B is updated to use the new version of A, but the version of B in pom.xml is not changed, then an AbstractMethodError is thrown at runtime if Metrics.newMethod() is called on a reference to FooMetrics.

I don't think missinglink:0.1.0 is capable of catching this because the bytecode would contain method call instructions that point to Metrics and not FooMetrics. missinglink would not know that there exists an implementation of Metrics on the classpath (and that it is used) that does not implement that new method.

Not sure if it will be feasible for missinglink to detect this but wanted to write it down while the details are fresh.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions