Exception mechanism aims to support the development of robust programs with reliable error detection, and fast error handling. This mechanism provides a way for programmers to separate code that deals with unusual situation from code that supports normal processing.
Because uncaught exceptions will abort the program`s execution, it is important to make sure at compile-time that the program will have no uncaught exceptions at run-time. Moreover, the information about exception propagation path can help programmers to make better use of exception mechanism. But local reasoning about the code is not sufficient to get such an information, because exceptions flow across methods and the information about uncaught exception (which exceptions are raised from a code block) is also required. So, the static analysis for the information about exception propagation path is necessary.
The current JDK Java compiler does an intraprocedural exception analysis by relying on the declared exceptions of methods, to check that the program will have no uncaught exceptions at run-time. The current compiler is not elaborate enough to do "better" than as declared by the programmers.
In this thesis, we propose an uncaught exception analysis of Java programs that estimates uncaught exceptions independently of the declared exceptions, and exception propagation analysis that estimates propagation paths of thrown exceptions. Our exception analyses are designed based on set-based framework.
In case of the uncaught exception analysis, we aim to develop an effective and accurate analysis. First, we design an expression-level analysis that analyzes uncaught exceptions at every expression of input programs. For enhancing cost-effectiveness of analysis, we design sparse analysis that analyzes uncaught exceptions at a larger granularity than at every expression. We prove the soundness and equivalence of accuracy between the two analyses. We implement our exception analysis and JDK-style except...