Abstract
This paper proposes a semantics-based automatic null pointer analysis for inferring non-null annotations of fields in object-oriented programs. The analysis is formulated for a minimalistic OO language and is expressed as a constraint-based abstract interpretation of the program which for each field of a class infers whether the field is definitely non-null or possibly null after object initialization. The analysis is proved correct with respect to an operational semantics of the minimalistic OO language. This correctness proof has been machine checked using the Coq proof assistant. We also prove the analysis complete with respect to the non-null type system proposed by Fähndrich and Leino, in the sense that for every typable program the analysis is able to prove the absence of null dereferences without any hand-written annotations. Experiments with a prototype implementation of the analysis show that the inference is feasible for large programs.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Cachera, D., Jensen, T.P., Pichardie, D., Rusu, V.: Extracting a data flow analyser in constructive logic. Theoretical Computer Science 342(1), 56–78 (2005)
Chalin, P., James, P.R.: Non-null references by default in Java: Alleviating the nullity annotation burden. In: Ernst, E. (ed.) ECOOP 2007. LNCS, vol. 4609, pp. 227–247. Springer, Heidelberg (2007)
Cielecki, M., Fulara, J., Jakubczyk, K., Jancewicz, Ł.: Propagation of JML non-null annotations in Java programs. In: Proc. of the 4th international symposium on Principles and practice of programming in Java (PPPJ 2006), pp. 135–140. ACM Press, New York (2006)
Das, M., Lerner, S., Seigle, M.: Esp: path-sensitive program verification in polynomial time. In: Proc. of the Conference on Programming language design and implementation (PLDI 2002), pp. 57–68. ACM Press, New York (2002)
Ekman, T., Hedin, G.: Pluggable non-null types for Java (ch. V). In: Ekman, T. (ed.) Extensible Compiler Construction, June 2006, Lund University (2006)
Fähndrich, M., Leino, K.R.M.: Declaring and checking non-null types in an object-oriented language. In: Proc. of Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA 2003), pp. 302–312. Springer, Heidelberg (2003)
Fähndrich, M., Xia, S.: Establishing object invariants with delayed types. In: OOPSLA 2007: Proc. of the 22nd conference on Object Oriented Programming Systems and Applications, pp. 337–350. ACM, New York (2007)
Flanagan, C., Leino, K.R.M.: Houdini, an annotation assistant for ESC/Java. In: Oliveira, J.N., Zave, P. (eds.) FME 2001. LNCS, vol. 2021, pp. 500–517. Springer, Heidelberg (2001)
Freund, S.N., Mitchell, J.C.: A formal framework for the java bytecode language and verifier. In: Proc. of the 14th conference on Object-oriented programming, systems, languages, and applications (OOPSLA 1999), pp. 147–166. ACM Press, New York (1999)
Hovemeyer, D., Pugh, W.: Finding more null pointer bugs, but not too many. In: PASTE 2007: Proc. of the 7th workshop on Program analysis for software tools and engineering, pp. 9–14. ACM Press, New York (2007)
Hovemeyer, D., Spacco, J., Pugh, W.: Evaluating and tuning a static analysis to find null pointer bugs. SIGSOFT Softw. Eng. Notes 31(1), 13–19 (2006)
Hubert, L., Jensen, T., Pichardie, D.: Semantic foundations and inference of non-null annotations. Research Report 6482, INRIA (March 2008)
Kawahito, M., Komatsu, H., Nakatani, T.: Effective null pointer check elimination utilizing hardware trap. SIGPLAN Not. 35(11), 139–149 (2000)
Leino, K.R.M., Saxe, J.B., Stata, R.: ESC/Java user’s manual. Compaq Systems Research Center, technical note 2000-002 edition (October 2000)
Male, C., Pearce, D.J., Potanin, A., Dymnikov, C.: Java bytecode verification for @NonNull types. In: Proc. of the Conference on Compiler Construction (CC 2008), Springer, Heidelberg (2008)
Vallée-Rai, R., Co, P., Gagnon, E., Hendren, L., Lam, P., Sundaresan, V.: Soot — a Java bytecode optimization framework. In: CASCON 1999: Proc. of the 1999 conference of the Centre for Advanced Studies on Collaborative research, p. 13. IBM Press (1999)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2008 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Hubert, L., Jensen, T., Pichardie, D. (2008). Semantic Foundations and Inference of Non-null Annotations. In: Barthe, G., de Boer, F.S. (eds) Formal Methods for Open Object-Based Distributed Systems. FMOODS 2008. Lecture Notes in Computer Science, vol 5051. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-68863-1_9
Download citation
DOI: https://doi.org/10.1007/978-3-540-68863-1_9
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-68862-4
Online ISBN: 978-3-540-68863-1
eBook Packages: Computer ScienceComputer Science (R0)