Lina Tran. NullSpy — An approach to pinpoint the origin location of a null reference. Bachelor’s thesis, University of Bern, December 2016. Details.
A previous study found that null pointer exceptions are the most frequently occurring exceptions in Java projects. Also, it is difficult to debug because a developer is only provided with a stack trace to the line of code where the exception was thrown. This only gives insight into the effect of the fault but not into its cause. The aim of the project is to provide the developer with an additional stack trace. It shows the location where the variable that caused the null pointer exception was initially assigned to null. We attempt to achieve this goal by instrumenting Java source code while striving for minimal execution overhead. By tracking the null assignments through static analysis and bytecode instrumentation we can achieve a more efficient debugging process after an occurrence of a null pointer exception.