我有一堂课Edge.java
。当我通过 OpenJML 运行它时,会发生这种情况:
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
奇怪的是,我什至还没有开始输入 jml 符号。
我的 jdk 是 1.7,openjml 是最新的(重新下载以确保)。
这是用于运行 openjml 的命令(按照站点中的示例):
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
编辑:我可以确认,即使是一个非常简单的泛型类也会导致这个错误:
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"
}
}