Previous paper

Next paper

Pluggable checking and inferencing of nonnull types for Java

Torbjörn Ekman, Computing Laboratory, Oxford University, United Kingdom
Görel Hedin, Department of Computer Science, Lund University, Sweden


PDF Icon
PDF Version


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.

Note: Due to the typographical sophistication of this article, no HTML version is available. Please use the PDF version.

About the authors

  Torbjörn Ekman is a Research Fellow at the Computing Laboratory at Oxford University, United Kingdom. He received a PhD from Lund University in 2006. His research interests include extensible compilers, scriptable refactorings, domain-specific languages, and aspect oriented programming. He can be reached at


Görel Hedin is an Associate Professor of computer science at Lund University, Sweden. She received a PhD from Lund University in 1992. Her research interests include object-oriented languages and systems, compilation technology, domain-specific languages, and agile methodologies. She has served on the program committees of many international workshops and conferences including ECOOP, CC, and LDTA. She can be reached at

Cite this document as follows: Torbjörn Ekman, Görel Hedin "Pluggable checking and inferencing of non-null types for Java", in Journal of Object Technology, vol. 6, no. 9, Special Issue: TOOLS EUROPE 2007, October 2007, pages 455–475,

Previous paper

Next paper