On the Interplay of Exception Handling and Design by Contract: An Aspect-Oriented Recovery Approach

Henrique Rebelo, Roberta Coelho, Ricardo Lima, Gary T. Leavens, Marieke Huisman, Alexandra Mota, Fernando Castor

    Research output: Chapter in Book/Report/Conference proceedingConference contributionAcademicpeer-review

    4 Citations (Scopus)
    15 Downloads (Pure)


    Design by Contract (DbC) is a technique for developing and improving functional software correctness through defi- nition 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 contem- porary 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 stop- ping 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 pro- posed technique could actually prevent the contract violations from being discarded regardless of the characteristics of the exception handling code of the target application.
    Original languageUndefined
    Title of host publicationProceedings of the 13th Workshop on Formal Techniques for Java-like Programs, FTfJP 2011
    EditorsS. Freund
    Place of PublicationNew York
    PublisherAssociation for Computing Machinery
    Number of pages6
    ISBN (Print)978-1-4503-0893-9
    Publication statusPublished - 26 Jul 2011
    Event13th Workshop on Formal Techniques for Java-like Programs, FTfJP 2011 - Lancaster, United Kingdom
    Duration: 26 Jul 201126 Jul 2011
    Conference number: 13

    Publication series



    Workshop13th Workshop on Formal Techniques for Java-like Programs, FTfJP 2011
    Abbreviated titleFTfJP
    Country/TerritoryUnited Kingdom
    Internet address


    • IR-77605
    • EWI-16994
    • METIS-277394

    Cite this