0

I have a class Edge.java. When I run it through OpenJML, this happens:

error: An internal JML error occurred, possibly recoverable. Please report the bug with as much information as you can. Reason: com.sun.tools.javac.code.Symbol$TypeSymbol cannot be cast to com.sun.tools.javac.code.Symbol$ClassSymbol

Weird thing is, I haven't even started to put in the jml notations.

My jdk is 1.7, openjml is current (re-downloaded both to make sure).

This is the command used to run openjml (following the example from the site): java -jar "E:\Downloads\openjml\openjml.jar" -esc -prover z3_4_3 -exec "E:\Downloads\z3-4.3.0-x64\bin\z3.exe" -noPurityCheck Test.java

Edit: I can confirm that even a very simple class with generics can cause this error:

public class Test<T> {
    T i;
}

Edge.java

public class Edge<K> implements Comparable<Edge<K>> {
    public K n1, n2;
    public int weight;

    public final int tiebreaker;
    public static int nextTiebreaker = 0;

    public Edge(K n1, K n2, int weight) {
        this.n1 = n1;
        this.n2 = n2;
        this.weight = weight;
        tiebreaker = nextTiebreaker++;
    }

    @Override
    public int compareTo(Edge<K> o) {
        if(this.weight > o.weight) return +1;
        if(this.weight < o.weight) return -1;

        return tiebreaker - o.tiebreaker; //Same cost, pick one to be the "larger" 
    }
}
Edwin
  • 886
  • 2
  • 13
  • 32
  • What version of java are you using? (needs to be Java 1.7). Try downloading OpenJML again? (I've just run it across your Edge.java and it reported no errors). Are you doing anything more complex than `java -jar openjml.jar Edge.java` ? if so, post command line. Do you have an SMT prover available? Which? – GregHNZ May 06 '14 at 09:09
  • My apologies, I'll edit the question to include more information. – Edwin May 06 '14 at 09:10
  • I can confirm that I get the same exception using the yices SMT prover on Linux. – GregHNZ May 06 '14 at 09:20

2 Answers2

0

The workaround that I found is to remove the -esc option (runs extended static checking). Not sure of the proper way to solve this.

Edwin
  • 886
  • 2
  • 13
  • 32
0

I am also facing similar issue, but using -esc option on B.java file under temp_release directory.

java -jar openjml.jar -noPurityCheck -esc  -progress -exec /Library/bin/z3 -prover z3_4_3 B.java
Proving methods in B
Starting proof of B.B() with prover z3_4_3
error: An internal JML error occurred, possibly recoverable.  Please report the bug with as much information as you can.
  Reason: Unexpected result when querying SMT solver for reason for an unknown result: success
Completed proof of B.B() with prover z3_4_3 - with warnings

B.Java is

public class B { /*@ invariant true; */ }.

Completed proving methods in B
Suresh
  • 1
  • 2