From 565be04fd26003c04f87648f1d8b4a9e6cc1052f Mon Sep 17 00:00:00 2001 From: parrt Date: Sun, 23 Oct 2011 19:23:51 -0800 Subject: [PATCH] sam changes [git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9179] --- .../v4/tool/templates/codegen/Java/Java.stg | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) 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 8213f4a1f..e8f2eb6ac 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 @@ -35,7 +35,6 @@ ListenerFile(listener, header) ::= <<
import org.antlr.v4.runtime.tree.ParseTreeListener; -@SuppressWarnings({"all", "warnings", "unchecked", "unused"}) public interface Listener extends ParseTreeListener { .Context ctx); @@ -49,15 +48,14 @@ BlankListenerFile(listener, header) ::= << import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.Token; -@SuppressWarnings({"all", "warnings", "unchecked", "unused"}) public class BlankListener implements Listener { .Context ctx) { \} -public void exitRule(.Context ctx) { \}}; separator="\n"> +@Override public void enterRule(.Context ctx) { \} +@Override public void exitRule(.Context ctx) { \}}; separator="\n"> - public void enterEveryRule(ParserRuleContext ctx) { } - public void exitEveryRule(ParserRuleContext ctx) { } - public void visitToken(Token token) { } + @Override public void enterEveryRule(ParserRuleContext ctx) { } + @Override public void exitEveryRule(ParserRuleContext ctx) { } + @Override public void visitToken(Token token) { } } >> @@ -180,8 +178,8 @@ RuleFunction(currentRule,code,locals,ruleCtx,altLabelCtxs,namedActions,finallyAc }>public final () throws RecognitionException { _localctx = new (_ctx, }>); - enterRule(_localctx, ); - //System.out.println("enter "+ruleNames[]+", LT(1)="+_input.LT(1).getText()); + enterRule(_localctx, RULE_); + //System.out.println("enter "+ruleNames[RULE_]+", LT(1)="+_input.LT(1).getText()); try { @@ -196,8 +194,8 @@ RuleFunction(currentRule,code,locals,ruleCtx,altLabelCtxs,namedActions,finallyAc } finally { - exitRule(); - // System.out.println("exit "+ruleNames[]); + exitRule(RULE_); + // System.out.println("exit "+ruleNames[RULE_]); } return _localctx; } @@ -557,8 +555,9 @@ public static class Context extends Context { >> VisitorDispatchMethod(method) ::= << +@Override public void enterexitRule(ParseTreeListener listener) { - ((Listener)listener).enterexitRule(this); + if ( listener!=null ) ((Listener)listener).enterexitRule(this); } >>