Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Annotate output missing invariant visibility with JML format #262

Open
GualterP opened this issue Jul 10, 2020 · 1 comment
Open

Annotate output missing invariant visibility with JML format #262

GualterP opened this issue Jul 10, 2020 · 1 comment

Comments

@GualterP
Copy link

Hello,

When executing Annotate with JML format, the annotated class invariants are missing their visibility. Annotate adds /*@spec_public */ to private variables in order for them to be used as public when proving the specification. Since the invariants' visibility is missing, when using the annotated code as input in OpenJML, their visibility defaults to package. This creates inconsistencies when proving programs.

Here is an excerpt example of this problem, using the attached code:

/*@ invariant this.customerID >= 1; /
/
@ invariant this.order != null; /
...
/
@ spec_public / private int customerID;
/
@ spec_public */ private Order order;

As is, we have package invariants over public variables. In OpenJML, the following error is obtained when proving this program: "An identifier with public visibility may not be used in a invariant clause with package visibility".

The expected result would be:
/*@ public invariant this.customerID >= 1; /
/
@ public invariant this.order != null; /
...
/
@ spec_public / private int customerID;
/
@ spec_public */ private Order order;

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

@markro49
Copy link
Contributor

Thanks for submitting an issue. We hope to investigate shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants