New exception interfaces for Java-like languages

The Java programming language allows developers to specify the exception interface of a method using the throws clause. This mechanism supports static checking that is coherent with a statically-typed language. However, it is known to have limitations. In particular, throws clauses hinder understandability and maintainability due to their scattered nature and lack of information about the source of an exception, the place where it is handled, and everything in between. In this paper, we propose a simple form of exception interface specification, called Exception Propagation Channel (EPC), that provides a global view of exception flow and complements Java's exception interfaces. Our approach stems from the observation that throws clauses scale well for methods that throw exceptions to large numbers of direct callers (horizontally), but not for long chains of method calls (vertically). We present an extension to the Java language, called EPiC-Java that incorporates the proposed approach as well as a prototype compiler and a reengineering tool for that extension. Application of the proposed approach to three open-source systems resulted in a considerable reduction in the number of throws clauses and a comparatively smaller number of EPCs, thus suggesting that maintainability is improved.

[1]  Eduardo Figueiredo,et al.  EJFlow: taming exceptional control flows in aspect-oriented programming , 2008, AOSD.

[2]  Martin P. Robillard,et al.  Designing robust Java programs with exceptions , 2000, SIGSOFT '00/FSE-8.

[3]  Ramnivas Laddad,et al.  Aspectj in Action: Practical Aspect-Oriented Programming , 2003 .

[4]  Gogul Balakrishnan,et al.  Interprocedural Exception Analysis for C++ , 2011, ECOOP.

[5]  Alexander Romanovsky,et al.  Supporting Evolution of Interface Exceptions , 2000, Advances in Exception Handling Techniques.

[6]  Alan Snyder,et al.  Exception Handling in CLU , 1979, IEEE Transactions on Software Engineering.

[7]  Paulo Marques,et al.  Exception Handling: A Field Study in Java and .NET , 2007, ECOOP.

[8]  Cristina V. Lopes,et al.  Aspect-oriented programming , 1999, ECOOP Workshops.

[9]  John B. Goodenough,et al.  Exception handling: issues and a proposed notation , 1975, CACM.

[10]  Cecília M. F. Rubira,et al.  A comparative study of exception handling mechanisms for building dependable object-oriented software , 2001, J. Syst. Softw..

[11]  Eric Steegmans,et al.  Combining the robustness of checked exceptions with the flexibility of unchecked exceptions using anchored exception declarations , 2005, OOPSLA '05.

[12]  Yannis Smaragdakis,et al.  Exception analysis and points-to analysis: better together , 2009, ISSTA.

[13]  P. M. Melliar-Smith,et al.  Software reliability: The role of programmed exception handling , 1977, Language Design for Reliable Software.

[14]  Stuart Horowitz,et al.  To Check, or Not to Check? , 2015 .