diff --git a/runtime/Java/src/org/antlr/v4/runtime/Parser.java b/runtime/Java/src/org/antlr/v4/runtime/Parser.java index 14f5bcf7d..e7af03393 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/Parser.java +++ b/runtime/Java/src/org/antlr/v4/runtime/Parser.java @@ -476,13 +476,6 @@ public abstract class Parser extends Recognizer return stack; } - /** For debugging and other purposes, might want the grammar name. - * Have ANTLR generate an implementation for this method. - */ - public String getGrammarFileName() { - return null; - } - /** For debugging and other purposes */ public List getDFAStrings() { List s = new ArrayList(); diff --git a/runtime/Java/src/org/antlr/v4/runtime/Recognizer.java b/runtime/Java/src/org/antlr/v4/runtime/Recognizer.java index f3a31bde3..db187a1b3 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/Recognizer.java +++ b/runtime/Java/src/org/antlr/v4/runtime/Recognizer.java @@ -53,15 +53,16 @@ public abstract class Recognizer { * error reporting. The generated parsers implement a method * that overrides this to point to their String[] tokenNames. */ - public String[] getTokenNames() { - return null; - } + public abstract String[] getTokenNames(); - public String[] getRuleNames() { - return null; - } + public abstract String[] getRuleNames(); - public ATN getATN() { return null; } + /** For debugging and other purposes, might want the grammar name. + * Have ANTLR generate an implementation for this method. + */ + public abstract String getGrammarFileName(); + + public abstract ATN getATN(); public ATNInterpreter getInterpreter() { return _interp; } diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg index 02d03003e..5007d9180 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg @@ -723,6 +723,7 @@ public class extends Lexer { _interp = new LexerATNSimulator(this,_ATN); } + @Override public String getGrammarFileName() { return ""; } @Override diff --git a/tool/src/org/antlr/v4/tool/interp/ParserInterpreter.java b/tool/src/org/antlr/v4/tool/interp/ParserInterpreter.java index 55683426f..aaf5d2d4d 100644 --- a/tool/src/org/antlr/v4/tool/interp/ParserInterpreter.java +++ b/tool/src/org/antlr/v4/tool/interp/ParserInterpreter.java @@ -45,6 +45,11 @@ public class ParserInterpreter { this.g = g; } + @Override + public String getGrammarFileName() { + return null; + } + @Override public String[] getRuleNames() { return g.rules.keySet().toArray(new String[g.rules.size()]); @@ -54,6 +59,11 @@ public class ParserInterpreter { public String[] getTokenNames() { return g.getTokenNames(); } + + @Override + public ATN getATN() { + return null; + } } protected Grammar g;