<dependency>
<groupId>org.jmlspecs</groupId>
<artifactId>c4j</artifactId>
<version>1.2.0</version>
</dependency>
public class ExampleClass {
@Requires({"x > 0", "y > 0"})
@Ensures("result > 0")
public int multiply(int x, int y) {
return x * y;
}
}
C4J.runtime().monitor(new ExampleClass());
try {
exampleClass.multiply(-1, 5);
} catch (ContractViolationException e) {
}