From 4e646746e6d342ad93786c89e4bdca164441d77e Mon Sep 17 00:00:00 2001 From: Terence Parr Date: Mon, 8 Aug 2022 17:10:32 -0700 Subject: [PATCH] Add `@SuppressWarnings("CheckReturnValue")` to prevent error_prone lib errors. Signed-off-by: Terence Parr Signed-off-by: Eric Vergnaud --- .../org/antlr/v4/tool/templates/codegen/Java/Java.stg | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 5aad297348..6ae7057576 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 @@ -113,6 +113,7 @@ import org.antlr.v4.runtime.tree.TerminalNode; * which can be extended to create a listener which only needs to handle a subset * of the available methods. */ +@SuppressWarnings("CheckReturnValue") public class BaseListener implements Listener { The return type of the visit operation. Use {@link Void} for * operations with no return type. */ +@SuppressWarnings("CheckReturnValue") public class BaseVisitor\ extends AbstractParseTreeVisitor\ implements Visitor\ { > Parser_(parser, funcs, atn, sempredFuncs, ctor, superClass) ::= << -@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"}) public class extends { static { RuntimeMetaData.checkVersion("", RuntimeMetaData.VERSION); } @@ -784,6 +786,7 @@ CaptureNextTokenType(d) ::= " = _input.LA(1);" StructDecl(struct,ctorAttrs,attrs,getters,dispatchMethods,interfaces,extensionMembers) ::= << +@SuppressWarnings("CheckReturnValue") public static class extends ParserRuleContext implements { ;}; separator="\n"> }; separator="\n"> @@ -806,6 +809,7 @@ public static class extends > AltLabelStructDecl(struct,attrs,getters,dispatchMethods) ::= << +@SuppressWarnings("CheckReturnValue") public static class extends Context { ;}; separator="\n"> }; separator="\n"> @@ -898,7 +902,7 @@ import org.antlr.v4.runtime.misc.*; >> Lexer(lexer, atn, actionFuncs, sempredFuncs, superClass) ::= << -@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast", "CheckReturnValue"}) public class extends { static { RuntimeMetaData.checkVersion("", RuntimeMetaData.VERSION); }