Google announces cofoja – Contracts for Java

Google announced the new project cofoja (Contracts for Java) that is hosted on Google Code.
The project Website describes the project as follows:

Contracts for Java enables you to write annotate your code with contracts in the form of preconditions, postconditions and invariants.

With this functionality it’s possible to change the following lines

public int addTwo(int positiveValue) {
// check preconditions
if(positiveValue<1) {
throw new IllegalArgumentException();
return positiveValue+2;


"positiveValue >= 1"
public int addTwo(int positiveValue) {
return positiveValue+2;

Views All Time
Views Today
Short URL for this post:
This entry was posted in Java and Quality and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *