Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Classpath Checker

Classpath Checker is a tool that finds static linkage errors on a class path and reports the errors to the console. It scans the class files in the class path for references to other classes and reports any reference that cannot be satisfied in the class path. It can report all such unsatisfied references or only those that are reachable from a given set of entry point classes.

Use Cases

There are two use cases for Classpath Checker:

  • For library/application developers the tool finds static linkage errors in their projects, and will help to avoid incompatible versions of libraries in their dependencies.

  • For organizations that provide multiple libraries developed by different teams, the tool helps to ensure that users depending on the libraries will not see any static linkage errors at runtime.

Approach

  1. The tool takes a class path as required input. This class path is called the input class path and is separate from the runtime class path of the tool itself. The tool operates on the input class path to find linkage errors.

  2. The tool extracts all symbolic references from the all class files in the class path.

  3. The tool records static linkage errors for symbolic references which cannot be satisfied in the class path.

  4. Optionally, the user can specify a subset of elements in the class path as entry points. In that case, the tool will list only those references that are reachable from the classes in the entry points.

  5. At the end, the tool outputs a report on the linkage errors.

Input

The input of the tool is the Maven coordinate of a BOM, a list of Maven coordinates, or a list of class and jar files in the filesystem. All of these inputs are converted to a class path for the classpath check, which is the input class path.

When the input is a Maven BOM, the elements in the BOM are converted to a list of Maven coordinates. If the BOM imports another BOM, the elements of the second BOM are recursively added to the list of Maven coordinates. This list of Maven coordinates is handled in the same way as a directly-provided list of coordinates (see below).

When the input is a list of Maven coordinates, they are resolved to a list of jar files that consists of the artifacts and their dependencies. This list of jar files is handled in the same way as a directly-provided list of jar files (see below).

When the input is a list of class and jar files, they are used directly as the input class path.

Output

The tool reports static linkage errors for the input class path. Each of the static linkage errors contains information on the source class and the destination class of the reference, and has one of the three types: missing class, missing method, or missing field.

Class Reference Graph and Reachability

In order to provide a diagnosis in the output report, the tool builds a class reference graph, and annotates linkage errors with reachability from entry point classes.

Entry point classes are different for the input of checks:

  • Check for a Maven BOM: classes in the Maven artifacts listed in the BOM
  • Check for a list of Maven coordinates: classes in the Maven artifacts
  • Check for a list of class and jar files: all classes in the input are entry points. This means that every linkage error is considered reachable.