Abstract
Exception-handling mechanisms in modern programming languages provide a means to help software developers build robust applications by separating the normal control flow of a program from the control flow of the program under exceptional situations. Separating the exceptional structure from the code associated with normal operations bears some consequences. One consequence is that developers wishing to improve the robustness of a program must figure out which exceptions, if any, can flow to a point in the program. Unfortunately, in large programs, this exceptional control flow can be difficult, if not impossible, to determine.In this article, we present a model that encapsulates the minimal concepts necessary for a developer to determine exception flow for object-oriented languages that define exceptions as objects. Using these concepts, we describe why exception-flow information is needed to build and evolve robust programs. We then describe Jex, a static analysis tool we have developed to provide exception-flow information for Java systems based on this model. The Jex tool provides a view of the actual exception types that might arise at different program points and of the handlers that are present. Use of this tool on a collection of Java library and application source code demonstrates that the approach can be helpful to support both local and global improvements to the exception-handling structure of a system.
- Abadi, M. and Cardelli, L. 1996. A Theory of Objects. Monographs in Computer Science, Springer-Verlag, New York, NY.]] Google Scholar
- Bacon, D. F. 1998. Fast and effective optimization of statically typed object-oriented languages. Ph.D. Thesis CSD-98-1017, (Oct.), University of California, Berkeley.]] Google Scholar
- Brennan, P. T. 1993. Observations on program-wide Ada exception propagation. In Proceedings of the Conference on TRI-Ada '93 (Sept.). ACM, 189--195.]] Google Scholar
- Buhr, P. A. and Mok, W. R. 2000. Advanced exception handling mechanisms. IEEE Trans. Softw. Eng. 26, 9 (Sept.), 820--836.]] Google Scholar
- Callahan, D., Cooper, K. D., Kennedy, K., and Torczon, L. 1986. Interprocedural constant propagation. In Proceedings of the 1986 SIGPLAN Symposium on Compiler Construction (June). ACM, 152--161.]] Google Scholar
- Chang, B.-M., Jo, J.-W., and Her, S. H. 2002. Visualization of exception propagation for Java using static analysis. In Proceedings of the Second International Workshop on Source Code Analysis and Manipulation (Oct.). IEEE, CA, 173--182.]] Google Scholar
- Chang, B.-M., Jo, J.-W., Yi, K., and Choe, K.-M. 2001. Interprocedural exception analysis for Java. In Proceedings of the 2001 ACM Symposium on Applied Computing (March). ACM, 620--625.]] Google Scholar
- Choi, J.-D., Grove, D., Hind, M., and Sarkar, V. 1999. Efficient and precise modeling of exceptions for the analysis of Java programs. In Proceedings of the ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering (Sept.). ACM, 21--31.]] Google Scholar
- Cousot, P. and Cousot, R. 1977. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proceedings of the Fourth Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (Jan.). ACM, 238--252.]] Google Scholar
- Dean, J., Grove, D., and Chambers, C. 1995. Optimization of object-oriented programs using static class hierarchy analysis. In Proceedings of the Ninth European Conference on Object-oriented Programming. Lecture Notes in Computer Science (Aug.), vol. 952. Springer-Verlag, 77--101.]] Google Scholar
- Dony, C. 1990. Exception handling and object-oriented programming: towards a synthesis. In Proceedings of the Conference on Object-oriented Programming Systems, Languages, and Applications, and of the European Conference on Object-oriented programming (Oct.). ACM, 322--330.]] Google Scholar
- Fahndrich, M., Foster, J., Cu, J., and Aiken, A. 1998. Tracking down exceptions in standard ML programs. Tech. Rep. CSD-98-996, Feb. University of California, Berkeley.]] Google Scholar
- Gamma, E., Helm, R., Johnson, R., and Vlissides, J. 1995. Design Patterns---Elements of Reusable Object-Oriented Software. Addison Wesley Longman, Inc., Reading, MA.]] Google Scholar
- Gauthier, M. 1995. Exception handling in Ada-94: Initial users' requests and final features. ACM Ada Letters, XV, 1 (Jan./Feb.), 70--82.]] Google Scholar
- Goodenough, J. B. 1975. Exception handling: Issues and proposed notation. Commun. ACM, 18, 12 (Dec.), 683--696.]] Google Scholar
- Gosling, J., Joy, B., and Steele, G. 1996. The Java Language Specification. Addison Wesley. Longman, Inc., Reading, MA.]] Google Scholar
- Guzmán, J. C. and Suárez, A. 1994. A type system for exceptions. In Proceedings of the 1994 ACM SIGPLAN Workshop on ML and Its Applications (June). ACM, 127--135.]]Google Scholar
- Halbert, D. C. and O'Brien, P. D. 1987. Using types and inheritance in object-oriented programming. IEEE Softw. 4, 5 (Sep.), 71--79.]]Google Scholar
- Heintze, N. 1992. Set-based program analysis. Ph.D. Thesis (Oct.), Carnegie-Mellon University, Pittsburgh, PA.]] Google Scholar
- Lang, J. and Stewart, D. B. 1998. A study of the applicability of existing exception-handling techniques to component-based real-time software technology. ACM Trans. Program. Lang. Syst. 20, 2 (Mar.), 274--301.]] Google Scholar
- Liskov, B. H. and Snyder, A. 1979. Exception handling in CLU. IEEE Trans. Softw. Eng. 5, 6 (Nov.), 546--558.]]Google Scholar
- Liskov, B. H. and Wing, J. M. 1994. A behavioral notion of subtyping. ACM Trans. Program. Lang. Syst. 16, 6 (Nov.), 1811--1841.]] Google Scholar
- Litke, J. D. 1990. A systematic approach for implementing fault tolerant software designs in Ada. In Proceedings of the Conference on TRI-ADA '90 (Dec.). ACM, 403--408.]] Google Scholar
- Maddison, W. and Maddison, D. 2001. Mesquite: A modular system for evolutionary analysis. http://mesquiteproject.org.]]Google Scholar
- Miller, R. and Tripathi, A. 1997. Issues with exception handling in object-oriented systems. In Proceedings of the 11th European Conference on Object-Oriented Programming. Lecture Notes in Computer Science (June), vol. 1241. Springer-Verlag, New York, NY, 85--103.]]Google Scholar
- Milner, R., Tofte, M., and Harper, R. W. 1990. The Definition of Standard ML. MIT Press, Cambridge, MA.]] Google Scholar
- Ogasawara, T., Komatsu, H., and Nakatani, T. 2001. A study of exception handling and its dynamic optimization in Java. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (Oct.). ACM, 83--95.]] Google Scholar
- Palsberg, J. and Schwartzbach, M. I. 1991. Object-oriented type inference. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (Oct.). ACM, 146--161.]] Google Scholar
- Pessaux, F. and Leroy, X. 1999. Type-based analysis of uncaught exceptions. In Proceedings of the 26th Symposium on the Principles of Programming Languages (Jan.). ACM, 276--290.]] Google Scholar
- Plevyak, J. and Chien, A. A. 1994. Precise concrete type inference for object-oriented languages. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (Oct.). ACM, 324--340.]] Google Scholar
- Robillard, M. P. and Murphy, G. C. 1999. Analyzing exception flow in Java programs. In Proceedings of the Seventh European Software Engineering Conference and Seventh ACM SIGSOFT Symposium on the Foundations of Software Engineering. Lecture Notes in Computer Science (Sept.) vol. 1687. Springer-Verlag, New York, NY, 322--337.]] Google Scholar
- Robillard, M. P. and Murphy, G. C. 2000. Designing robust Java programs with exceptions. In Proceedings of the 8th ACM SIGSOFT International Symposium on the Foundations of Software Engineering (Nov.). ACM Press, New York, NY, 2--10.]] Google Scholar
- Romanovsky, A. and Sandén, B. 2001. Except for exception handling. Ada Letters 21, 3 (Sept.), 19--25 (Proceedings of the Workshop on Exception Handling for a 21st Century Programming Language).]] Google Scholar
- Ryder, B. G., Smith, D., Kremer, U., Gordon, M., and Shah, N. 1999. A static study of Java exceptions using JESP. Tech. Rep. DSC-TR-406 (Oct.). Department of Computer Science, Rutgers University.]]Google Scholar
- Ryu, S. and Yi, K. 2001. Exception analysis for multithreaded Java programs. In Proceedings of the Second Asia-Pacific Conference on Quality Software (Dec.). IEEE Computer Society Press, Los Alamitos, CA, 23--30.]] Google Scholar
- Schaefer, C. F. and Bundy, G. N. 1993. Static analysis of exception handling in Ada. Softw. Pract. Exper. 23, 10 (Oct.), 1157--1174.]] Google Scholar
- Scott, M. L. 2000. Programming Language Pragmatics. Morgan Kaufmann Publishers, San Francisco, CA.]] Google Scholar
- Shelekhov, V. I. and Kuksenko, S. V. 1999. Data flow analysis of Java programs in the presence of exceptions. In Proceedings of the third International Andrei Ershov Memorial Conference on Perspectives of System Informatics. Lecture Notes in Computer Science (July), vol. 1755. Springer-Verlag, New York, NY, 389--396.]] Google Scholar
- Sinha, S. and Harrold, M. J. 1999. Criteria for testing exception-handling constructs in Java programs. In Proceedings of the International Conference on Software Maintenance (Sept.). IEEE Computer Society Press, Los Alamitos, CA, 265--274.]] Google Scholar
- Sinha, S. and Harrold, M. J. 2000. Analysis and testing of programs with exception handling constructs. IEEE Trans. on Softw. Eng. 26, 9 (Sept.), 849--871.]] Google Scholar
- Stroustrup, B. 1991. The C++ Programming Language, 2nd ed. Addison Wesley Longman, Inc., Reading, MA.]] Google Scholar
- U.S. Department of Defense 1983. Reference Manual for the Ada Programming Language, ANSI/Military Standard MIL-STD-1815A-1983. U.S. Department of Defense.]] Google Scholar
- Yemini, S. and Berry, D. M. 1985. A modular verifiable exception-handling mechanism. ACM Trans. Program. Lang. Syst. 7, 2 (Apr.), 214--243.]] Google Scholar
- Yi, K. 1998. An abstract interpretation for estimating uncaught exceptions in standard ML programs. Sci. Comp. Program. 31, 1 (May), 147--173.]] Google Scholar
- Yi, K. and Ryu, S. 1997. Towards a cost-effective estimation of uncaught exceptions in SML programs. In Proceedings of the 4th International Static Analysis Symposium. Lecture Notes in Computer Science (Sept.), vol. 1302. Springer-Verlag, 98--113.]] Google Scholar
Index Terms
- Static analysis to support the evolution of exception structure in object-oriented systems
Recommendations
A review on exception analysis
Context: Exception handling has become popular in most major programming languages, including Ada, C++, Java, and ML. Since exception handling was introduced in programming languages, there have been various kinds of exception analyses, which analyze ...
Efficient Java exception handling in just-in-time compilation
Research ArticlesJava uses exceptions to provide elegant error handling capabilities during program execution. However, the presence of exception handlers complicates the job of the just-in-time (JIT) compiler, while exceptions are rarely used in most programs. This ...
Exception evolution in long-lived Java systems
MSR '17: Proceedings of the 14th International Conference on Mining Software RepositoriesException handling allows developers to deal with abnormal situations that disrupt the execution flow of a program. There are mainly three types of exceptions: standard exceptions provided by the programming language itself, custom exceptions defined by ...
Comments