Fork me on GitHub

Java API Compliance Checker

A tool for checking backward API/ABI compatibility of a Java library

Java API Compliance Checker (JAPICC) is a tool for checking backward binary and source-level compatibility of a Java library API. The tool checks classes declarations of old and new versions and analyzes changes that may break compatibility: removed methods, removed class fields, added abstract methods, etc. The HTML compatibility report generated by this tool includes separate sections for both source and binary compatibility analysis and exact error messages of the jvm and the compiler for each break found in the API.

Binary incompatibility may result in crashing or incorrect behavior of existing clients built with an old version of a library when they are running with a new one. Source incompatibility may result in recompilation errors with a new library version. The tool is intended for developers of software libraries and Linux maintainers who are interested in ensuring backward compatibility, i.e. allow old clients to run or to be recompiled with newer library versions.

The Scala language is supported since 1.7 version of the tool.

Java 9 is supported since 2.4 version of the tool.

The tool is a core of the Java API Tracker project.

Table of Contents

Downloads

The latest release can be downloaded from this page.

Read-only access to the latest development version:

 git clone https://github.com/lvc/japi-compliance-checker.git 

License

This program is free software. You may use, redistribute and/or modify it under the terms of the GNU LGPL

Supported Platforms

GNU/Linux, FreeBSD, Mac OS X, MS Windows.

Dependencies

Installation

The tool is ready-to-use after extracting the archive.

You can also use a Makefile to install the tool into the system:

 cd japi-compliance-checker-x.y.z/ 

 sudo make install prefix=PREFIX [/usr, /usr/local, ...] 

This command will install the japi-compliance-checker program into the PREFIX/bin system directory and private modules into the PREFIX/share.

To verify that the tool is installed correctly and it works on your host run:

 cd tmp/ 

 japi-compliance-checker -test 

Usage

Use the following command to compare two Java archives:

 japi-compliance-checker -lib NAME V1.jar V2.jar 

The compatibility report will be generated to:

 compat_reports/NAME/V1_to_V2/compat_report.html 

Usage (Multiple Archives)

To compare different versions of a library that consists of many JARs you should create XML descriptors for two library versions: v1.xml and v2.xml files. Library descriptor is a simple XML-file that specifies version number, paths to Java archives and other optional information. An example of the descriptor is the following:

<version>
    1.0
</version>

<archives>
    /path1/to/JAR(s)/
    /path2/to/JAR(s)/
       ...
</archives>

Command to compare two versions of a library:

japi-compliance-checker -lib NAME -old V1.xml -new V2.xml

The compatibility report will be generated to:

compat_reports/NAME/V1_to_V2/compat_report.html

Examples

LibraryVersionsReport
Guava 18.0 vs 19.0 report
SLF4J 1.5.11 vs 1.6.0 report
ICU4J 56_1 vs 57_1 report

See more report examples at https://abi-laboratory.pro/java/tracker/.

Detectable Compatibility Problems

The tool searches for the following list of changes in the API that may break binary/source-level compatibility. See “Evolving Java-based APIs: Achieving API Binary Compatibility” for more info.

Test Suite

The tool is tested properly in the Java API Tracker project, by the community and by the internal test suite:

japi-compliance-checker -test

There are about 80 basic tests in the test suite.

API Dumps

The API dump is a dump of the API model used in the tool. You can create API dump by the -dump option and use it instead of the Java archive.

The API dump consists of:

To create an API dump use -dump option:

japi-compliance-checker -lib NAME -dump LIB.jar -dump-path ./API.dump

To compare API dumps pass them instead Java archives:

japi-compliance-checker -lib NAME -old API-0.dump -new API-1.dump

Report Format

The HTML-format compatibility report consists of:

Verdict on Compatibility

If the tool detected problems with high or medium level of severity or at least one removed method then the compatibility verdict is incompatible (otherwise compatible). Low-severity problems can be considered as warnings and don't affect the compatibility verdict unless the -strict option is specified.

Error Codes

CodeMeaning
0Compatible. The tool has run without any errors.
1Incompatible. The tool has run without any errors.
2Common error code (undifferentiated).
3A system command is not found.
4Cannot access input files.
7Invalid input API dump.
8Unsupported version of input API dump.
9Cannot find a module.

Similar Tools

Bugs

Please post bug reports, feature requests and questions to the issue tracker.

Maintainers

The tool is developed by Andrey Ponomarenko.

Changes

You can find changelog here.

Articles