should not be a default version lest all targets pass by default. make sure java target and tool move in lockstep. Fixes #572

This commit is contained in:
Terence Parr 2014-05-28 17:54:44 -07:00
parent 0b8a70a2a4
commit 9e77e28bc1
2 changed files with 10 additions and 6 deletions

View File

@ -30,6 +30,7 @@
package org.antlr.v4.codegen;
import org.antlr.v4.Tool;
import org.antlr.v4.tool.ast.GrammarAST;
import org.stringtemplate.v4.STGroup;
import org.stringtemplate.v4.StringRenderer;
@ -39,10 +40,6 @@ import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
/**
*
* @author Sam Harwell
*/
public class JavaTarget extends Target {
protected static final String[] javaKeywords = {
@ -63,7 +60,12 @@ public class JavaTarget extends Target {
super(gen, "Java");
}
public Set<String> getBadWords() {
@Override
public String getVersion() {
return Tool.VERSION; // Java and tool versions move in lock step
}
public Set<String> getBadWords() {
if (badWords.isEmpty()) {
addBadWords();
}

View File

@ -91,8 +91,10 @@ public abstract class Target {
/** ANTLR tool should check output templates / target are compatible with tool code generation.
* For now, a simple string match used on x.y of x.y.z scheme. We use a method to avoid mismatches
* between a template called VERSION. This value is checked against Tool.VERSION during load of templates.
*
* This additional method forces all targets 4.3 and beyond to add this method.
*/
public String getVersion() { return "4.3"; }
public abstract String getVersion();
public STGroup getTemplates() {
if (templates == null) {