Search

Strong exception-safety for checked and unchecked exceptions

By: Giovanni Lagorio, Marco Servetto

Abstract

“Exception-safety strong guarantee: The operation has either completed successfully or thrown an exception, leaving the program state exactly as it was before the operation started.” — David Abrahams. The above definition of strong exception-safety comes from the world of C++, but it can be applied to any language. Because the exception-safety strong guarantee plays a central role in easing the development of robust software, we have designed a type-system able to capture its essence. The idea is that the state of the reachable objects at the beginning of a catch block is the same as the beginning of the corresponding try block. We present a lightweight type system for Java-like languages that, by introducing a simple modifier to types, enforces that programs satisfy the strong guarantee in the presence of checked and unchecked exceptions.

Keywords

Exceptions, safety guarantees

Cite as:

Giovanni Lagorio, Marco Servetto, “Strong exception-safety for checked and unchecked exceptions”, Journal of Object Technology, Volume 10, (2011), pp. 1:1-20, doi:10.5381/jot.2011.10.1.a1.

PDF | DOI | BiBTeX | Tweet this | Post to CiteULike | Share on LinkedIn