Detecting API changes/evolution [closed]

房东的猫 提交于 2019-11-28 23:45:41

I'd use Clirr for that, a binary compatibility checker. From the Clirr web site:

What is it?

Clirr is a tool that checks Java libraries for binary and source compatibility with older releases. Basically you give it two sets of jar files and Clirr dumps out a list of changes in the public api. The Clirr Ant task can be configured to break the build if it detects incompatible api changes. In a continuous integration process Clirr can automatically prevent accidental introduction of binary or source compatibility problems.

...

Features

  • Report all API changes (currently only partially implemented)
  • Evaluate each change wrt. binary and source compatibility
  • support plain text and XML reports
  • Flexible failure handling (warnings vs. errors, break the build or set error property)

There's also a new API evolution checking tool called Revapi

Btw there seems to be an api-checker in the gwt source code, don't know if that is the product of the mentioned GSoc project.

GwtJavaApiCompatibilityChecker is also used in build.xml

JDiff is maybe also worth a mentioning.

JDiff is a Javadoc doclet which generates an HTML report of all the packages, classes, constructors, methods, and fields which have been removed, added or changed in any way, including their documentation, when two APIs are compared. This is very useful for describing exactly what has changed between two releases of a product. Only the API (Application Programming Interface) of each version is compared. It does not compare what the source code does when executed.

As I understood it runs on the sourcefolder of the old version and generates an xml file. The same for the sourcefolder with the new version. Than the two xml-outputs are compared and a changelist compiled. In html-javadoc-api-style

You might also want to try japicmp.

Try japi-compliance-checker tool. It's open-source. The tool shows API changes and detects both backward source (SC) and backward binary (BC) compatibility issues between two jar archives:

japi-compliance-checker -old LIB-0.jar -new LIB-1.jar

Sample reports for log4j: http://abi-laboratory.pro/java/tracker/timeline/log4j/

You can find classification of found compatibility problems by severity level in the reports for particular library versions:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!