Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Annotate adds \old environment to non-static fields with JML format #263

Open
GualterP opened this issue Jul 10, 2020 · 0 comments
Open

Comments

@GualterP
Copy link

Hello,

When proving (using OpenJML) the attached example code, which is annotated with the results from running Annotate, the following errors occur:

error: Non-static fields are not allowed in \old environments in postconditions: cID
@ ensures this.customerID == \old(cID);

error: Non-static fields are not allowed in \old environments in postconditions: oID
@ ensures this.orderID == \old(oID);

The corresponding postconditions appear in:

/*@
@ public normal_behavior // Generated by Daikon
**@ ensures this.customerID == \old(cID);**
@ ensures this.order.orderID == -1;
@*/
public Customer(int cID) {
	this.customerID = cID;
	this.order = new Order(-1);
}

/*@
@ public normal_behavior // Generated by Daikon
@ requires oID >= -1;
**@ ensures this.orderID == \old(oID);**
@*/
public Order(int oID) {
	this.orderID = oID;
}

The expected results would be that Daikon's Annotate would output non-static fields without the \old environment:

    /*@
@ public normal_behavior // Generated by Daikon
**@ ensures this.customerID == cID;**
@ ensures this.order.orderID == -1;
@*/
public Customer(int cID) {
	this.customerID = cID;
	this.order = new Order(-1);
}

/*@
@ public normal_behavior // Generated by Daikon
@ requires oID >= -1;
**@ ensures this.orderID == oID;**
@*/
public Order(int oID) {
	this.orderID = oID;
}

The following commands were used in order to obtain the shown results:
javac -g *.java
java -cp .:$DAIKONDIR/daikon.jar daikon.DynComp Tester
java -cp .:$DAIKONDIR/daikon.jar daikon.Chicory --daikon --comparability-file=Tester.decls-DynComp Tester
java -cp .:$DAIKONDIR/daikon.jar daikon.tools.jtb.Annotate --format jml Tester.inv.gz Customer.java Order.java

I am using Daikon 5.8.0 with Java 11, in Ubuntu 18.04.

Thank you.
example.zip

@codespecs codespecs deleted a comment from markro49 Jul 14, 2020
@codespecs codespecs deleted a comment from jmool9810 Jul 14, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant