Publication Date

Fall 2015

Degree Type

Master's Project

Degree Name

Master of Science (MS)


Computer Science

First Advisor

Thomas Austin

Second Advisor

Chris Pollett

Third Advisor

Ron Mak


Programmers are now developing large and complex software systems, so it’s important to have software that is consistent, efficient, and robust. Programming contracts allow developers to specify preconditions, postconditions, and invariants in order to more easily identify programming errors. The design by contract principle [1] was first used in the Eiffel programming language [2], and has since been extended to libraries in many other languages. The purpose of my project is to design a programming contract library for Java. The library supports a set of preconditions, postconditions, and invariants that are specified in Java annotations. It incorporates contract checking for objects of classes following the bean notation [3]. The library also supports checking for user-defined functions as contract conditions. This feature allows the user to check for complex contract conditions. In addition to these, the library supports contracts using lambdas in Java 8 [4], which to our knowledge has not been done in previous works on Java contracts. While the results show us that enabling contracts lowers the performance of the system, especially when lambda contracts are used, we also demonstrate how careful design can significantly reduce the overhead.