Static analysis method for detecting null pointer dereference in Java
Yue Ma · Journal of Tsinghua University(Science and Technology) · 2011
Null pointer dereference(NPD) faults are commonly hidden in programs.Detecting these faults by dynamic tests is complicated,time-consuming,and uncompleted.This paper introduces a static analysis method for detecting NPD faults.The NPD fault features are formally described using a defect finite state machine.Then,the creation conditions and semantic information from the source codes are used to create instances that are put into the entry nodes of a control flow graph(CFG).The machine states are then iterated along the CFG nodes based on the dataflow analysis result.When the machine state transits to an error,a potential NPD fault exists.This method has been implemented in a defect testing system(DTS) with test results from testing projects,such as Robocode,showing the effectiveness of this method.