I'm getting an error when compiling a tool I wrote. The tool is pretty much the most minimal XPath search tool that can be written by using ANTLR. It's mostly copy-pasted from different examples.
This code is compiling correctly when using with Java parser classes generated from the most recent antlr grammar:
https://github.com/antlr/grammars-v4/blob/master/java/Java.g4import org.antlr.v4.runtime.tree.ParseTree;
import org.antlr.v4.runtime.tree.xpath.XPath;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.ANTLRInputStream;
public class JPath{
public static void main(String args[]){
String input = "class Foo{ public static void main(String args[]){ bar(); }}";
JavaLexer lexer = new JavaLexer(new ANTLRInputStream(input));
CommonTokenStream tokens = new CommonTokenStream(lexer);
JavaParser parser = new JavaParser(tokens);
JavaParser.CompilationUnitContext tree = parser.compilationUnit(); // parse a compilationUnit
String xpath = "//methodBody";
for (ParseTree t : XPath.findAll(tree, xpath, parser) ) {
//do nothing
}
}
}
However, running the class gives me an error message:
ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.6
I'm using the most recent complete jar downloaded from the antlr website:
shasum antlr-4.6-complete.jar
85a2c715cca0455ea0b6dac60e5f525a70b2bf4d antlr-4.6-complete.jar
Is this a known issue that has a known fix, or is the complete jar at the main website packaged incorrectly?