Skip to content

Add API compatibility linting to CI #1901

@zeitlinger

Description

@zeitlinger

Summary

Add automated API compatibility checking to CI to detect source-incompatible
and binary-incompatible changes before they are released.

Motivation

In 1.5.0, PR #1800 changed MetricWithFixedMetadata.getMetadata() from
protected to public — a source-incompatible change that was not caught
during review (see #1897).

Tools to add

Both are used by OpenTelemetry Java
and complement each other:

  1. japicmp — Maven plugin that
    compares two versions of a JAR and reports binary/source incompatibilities.
    Catches changes like visibility narrowing, method removal, signature
    changes, etc.
  2. Animal Sniffer — checks
    that code only uses APIs from a defined API signature. Useful for enforcing
    a stable public API baseline.

Acceptance criteria

  • japicmp integrated into CI, failing on binary/source-incompatible
    changes to public/protected API
  • Animal Sniffer integrated into CI, checking against a defined API
    signature baseline
  • Mechanism to explicitly allow intentional breaking changes (e.g.,
    baseline file or annotation)
  • Documented in CLAUDE.md / contributor guide

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions