On the interplay of exception handling and design by contract: an aspect-oriented recovery approach

  • Authors:
  • Henrique Rebêlo;Roberta Coelho;Ricardo Lima;Gary T. Leavens;Marieke Huisman;Alexandre Mota;Fernando Castor

  • Affiliations:
  • Federal University of Pernambuco, PE, Brazil;Federal University of Rio Grande do Norte, RN, Brazil;Federal University of Pernambuco, PE, Brazil;University of Central Florida, Fl;University of Twente, Netherlands;Federal University of Pernambuco, PE, Brazil;Federal University of Pernambuco, PE, Brazil

  • Venue:
  • Proceedings of the 13th Workshop on Formal Techniques for Java-Like Programs
  • Year:
  • 2011

Quantified Score

Hi-index 0.02

Visualization

Abstract

Design by Contract (DbC) is a technique for developing and improving functional software correctness through definition of "contracts" between client classes and their suppliers. Such contracts are enforced during runtime and if any of them is violated a runtime error should occur. Runtime assertions checkers (RACs) are a well-known technique that enforces such contracts. Although they are largely used to implement the DbC technique in contemporary languages, like Java, studies have shown that characteristics of contemporary exception handling mechanisms can discard contract violations detected by RACs. As a result, a contract violation may not be reflected in a runtime error, breaking the supporting hypothesis of DbC. This paper presents an error recovery technique for RACs that tackles such limitations. This technique relies on aspect-oriented programming in order to extend the functionalities of existing RACs stopping contract violations from being discarded. We applied the recovery technique on top of five Java-based contemporary RACs (i.e., JML/jml, JML/ajml, JContractor, CEAP, and Jose). Preliminary results have shown that the proposed technique could actually prevent the contract violations from being discarded regardless of the characteristics of the exception handling code of the target application.