Pluggable checking and inferencing of nonnull types for Java

By: Torbjörn Ekman, Görel Hedin


We have implemented a non-null type checker for Java and a new non-null inferencing algorithm for analyzing legacy code. The tools are modular extensions to the JastAdd extensible Java compiler, illustrating how pluggable type systems can be achieved. The resulting implementation is compact, less than 230 lines of code for the non-null checker and 460 for the inferencer. Non-null checking is a local analysis with little effect on compilation time. The inferencing algorithm is a whole-program analysis, yet it runs sufficiently fast for practical use, less than 10 seconds for 100.000 lines of code. We ran our inferencer on a large part of the JDK library, and could detect that around 70% of the dereferences, and around 24% of the method return values, were guaranteed to be non-null.

Cite as:

Torbjörn Ekman, Görel Hedin, “Pluggable checking and inferencing of nonnull types for Java”, Journal of Object Technology, Volume 6, no. 9 (October 2007), pp. 455-475, doi:10.5381/jot.2007.6.9.a23.

PDF | HTML | DOI | BiBTeX | Tweet this | Post to CiteULike | Share on LinkedIn

The JOT Journal   |   ISSN 1660-1769   |   DOI 10.5381/jot   |   AITO   |   Open Access   |    Contact