Tool version used for code generation does not match the current runtime version

4,618 views
Skip to first unread message

guth....@gmail.com

unread,
Feb 24, 2017, 2:45:06 AM2/24/17
to antlr-discussion
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.g4

import 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?

Mike Lischke

unread,
Feb 24, 2017, 4:14:34 AM2/24/17
to antlr-di...@googlegroups.com
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:

Probably related to this issue: https://github.com/antlr/antlr4/issues/1620.

guth....@gmail.com

unread,
Feb 27, 2017, 7:15:40 AM2/27/17
to antlr-discussion
For anybody who finds themselves here in the future, the XPath lexer still works in 4.5.3, so you can simply revert to an older version while the fix is on the way.
git checkout 4.5.3
mvn
-DskipTests install


Reply all
Reply to author
Forward
0 new messages