# OW2 JML-annotated use cases

Objective: provide JML annotations in java code to train AIs.

The JML is located in the *-JML directories (authzforce-core-JML, joram-JML, lutece-core-JML, my-thai-star-JML and sat4j-JML).

In the 5 use-cases proposed here, almost 3.000 JML annotations (@non_null, @pure and @modifies) have been inserted in about 700 java files.

## MyThaiStar

Note: MyThaiStar is NOT a OW2 use-case, but is mentioned here because it is used as a demonstrator use-case for Decoder.

### Clone MyThaiStar project, then copy JML there:

```
git clone https://github.com/devonfw/my-thai-star.git
cp -r my-thai-star-JML/* my-thai-star
```

Tested on commit #4ff3fb6 (git checkout 4ff3fb6).

## Sat4j

### Clone sat4j project, then copy JML there:

```
git clone https://gitlab.ow2.org/sat4j/sat4j.git
cp -r sat4j-JML/* sat4j
```

Tested on commit #4d2dea08 (git checkout 4d2dea08).

## Joram

### Clone joram project, then copy JML there:

```
git clone https://gitlab.ow2.org/joram/joram.git
cp -r joram-JML/* joram
```

Tested on commit #bb4518d6 (git checkout bb4518d6).

## Lutece core

### Clone lutece core project, then copy JML there:

```
git clone https://github.com/lutece-platform/lutece-core.git
cp -r lutece-core-JML/* lutece-core
```

Tested on commit #469c86d (git checkout 469c86d).

## Authzforce core

### Clone authzforce core project, then copy JML there:

```
git clone https://github.com/authzforce/core.git
cp -r authzforce-core-JML/* core
```

Tested on commit #ca86ff5 (git checkout ca86ff5).
Warning: authzforce core needs a JDK 8 to compile (java 11 not supported).


## JML generation method

JML provided here was automatically generated using jmlgen, a DCR utilitary tool developed by OW2, available here: https://gitlab.ow2.org/decoder/jmlgen .

Instructions below about running jmlgen assume that jmlgen has been cloned and built ($JMLGEN refers to target/ directory inside jmlgen).

### To run jmlgen on MyThaiStar:

```
java -jar $JMLGEN/jmlgen-0.0.1-SNAPSHOT.jar my-thai-star/java/mtsj my-thai-star-JML/java/mtsj api/src/main/java:batch/src/main/java:core/src/main/java
```

### To run jmlgen on sat4j:

```
java -jar $JMLGEN/jmlgen-0.0.1-SNAPSHOT.jar sat4j sat4j-JML org.sat4j.br4cp/src/main/java:org.sat4j.core/src/main/java:org.sat4j.intervalorders/src/main/java:org.sat4j.maxsat/src/main/java:org.sat4j.pb/src/main/java:org.sat4j.sat/src/main/java:org.sat4j.sudoku/src/main/java
```

### To run jmlgen on joram:

Warning: run command on "joram/joram" subdir.

```
java -jar $JMLGEN/jmlgen-0.0.1-SNAPSHOT.jar joram/joram joram-JML/joram shell/mom/src/main/java:shell/jndi/src/main/java:shell/a3/src/main/java:joram/mom/amqp/src/main/java:joram/mom/extensions/ftp/src/main/java:joram/mom/extensions/mail/src/main/java:joram/mom/extensions/amqp/src/main/java:joram/mom/extensions/scheduler/src/main/java:joram/mom/extensions/collector/src/main/java:joram/mom/extensions/restbridge/src/main/java:joram/mom/extensions/jmsbridge/src/main/java:joram/mom/core/src/main/java:joram/tools/jasp/src/main/java:joram/tools/monitoring/src/main/java:joram/tools/rest/admin/src/main/java:joram/tools/rest/jmx/src/main/java:joram/tools/rest/jms/src/main/java:joram/shared/src/main/java:joram/security/jonas/src/main/java:joram/client/jca/src/main/java:joram/client/spring/src/main/java:joram/client/jms/src/main/java:jndi/shared/src/main/java:jndi/server/src/main/java:jndi/client/src/main/java:a3/rt/src/main/java:a3/common/src/main/java:a3/osgi/src/main/java:a3/services/src/main/java
```

### To run jmlgen on lutece-core:

```
java -jar $JMLGEN/jmlgen-0.0.1-SNAPSHOT.jar lutece-core lutece-core-JML src/java
```

### To run jmlgen on authzforce-core:

```
java -jar $JMLGEN/jmlgen-0.0.1-SNAPSHOT.jar core authzforce-core-JML pdp-cli/src/main/java:pdp-engine/src/main/java:pdp-io-xacml-json/src/main/java:pdp-testutils/src/main/java
```

