How do we apply JML (openJML) to Java Code?

1.2k views Asked by At

How do we apply JML to Java Code? I'm still new in Design by Contracts and quite lost on how to apply it into the program.

http://jmlspecs.sourceforge.net/

Using:

  • OpenJML
  • Netbeans 7.3
  • Java SDK 1.7

I have already added the OpenJML jar files into the classpath of Netbeans. i tried the cofoga google jml version where you simply import com.google.java.contract.Ensures; import com.google.java.contract.Requires then you can add the pre and post conditions

How do we specify the pre condition and post condition using openJML in my program?

1

There are 1 answers

0
Mark On

I found what that is needed; is importing the library with annotations:

import org.jmlspecs.annotation.Requires;
import org.jmlspecs.annotation.Ensures;