Celtique Project

Nit: Nullability Inference Tool

Nit/Eclipse: Nit as a Plug-in for Eclipse


Nit/Eclipse allows to use Nit in the Eclipse environment. It analyzes the Java projects managed by Eclipse. Then it adds visual information to the sources of this Java Project.

Information is obtained from XML output of Nit, which contains nullness and initialization informations for fields, methods and return values.

There are two kinds of visual representations for these annotations.

  • Java Text Hovers are contextual pop-up displaying information when the mouse stands over a text region. Typically, the nullness and initialisation information about fields and methods are located in their declaration and are displayed after the Javadoc.
  • Markers are Eclipse entities which allow to underline some parts of the text and associate them a severity (information, warning, error). This plug-in can warn the user about null pointer dereferencing by underlying the corresponding lines in the code. It can also warn about manipulations of objects which have not been initialized yet.

Installing the plug-in

To install Nit plug-in, simply add the URL as an update site in the Eclipse menu Help -> Software Updates, and follow the standard install procedure.

Getting started

Showing the view

Nit View is the entry point of the plug-in because it allows to configure the paths that Nit needs for its analysis (included Nit location), to select Nit options and to choose what kind of information has to be displayed in the sources.

To select Nit View, simply enter the menu Window -> Show View -> Other and select the view Nit in Nit category.

Nit View screenshot

Then a panel should appear at the bottom of the opened perspective but you can move it to the left side of the code which is more convenient.

Nit View screenshot

The first item is a combo-box which displays all the available projects in the current workspace that Nit can analyse. If some project are closed in the workspace or are not related to Java code, they won't appear.

If a Nit configuration was previously saved, the corresponding fields will recover their value when selecting the project name.

Nit options

Nit options are composed of two kinds of assumptions we want to make during the analysis :

  • Non-Null assumptions assume that none of the concerned types can be null.
  • Non-Raw assumptions assume that the concerned references never refer to an object that has not finished its constructor.

These options are unsafe: they allow to remove false-positives but may introduce false-negatives.

Launching an analysis

Nit analysis is included in an eclipse builder associated to Java projects and occurs at the end of each build tentative of the project.

[Actually it occurs even if the project don't compile...]

If a project is configured in auto-build mode, the analysis will occur every time this project is saved. More specifically, when saving a Nit configuration, the .project file associated to the project is modified and saved, which leads to launching the analysis.

Display options

Options are divided into nullness and initness concerns. Each of these categories have a part of documentation inserted in the Javadoc and a part of warnings produced by markers in the project files.

Documentation example
Example of documentation (nullness and initness) on a method declaration.

Nullness warning example
Example of nullness warning.

Initialization warning example
Example of initness warning.

Last modification: 2009-09-25 19:17:08.000000000 +0200
This website uses Google Analytics