How do I turn off the warnings that antlr generated classes show?

If you use a JDK >= 5.0 you can tweak the Java.stg template to suppress all warnings. This way, the generated classes will also carry the suppress warnings, since they are template based.

Search for the class definition in the template, and just add the @SuppressWarnings stuff:

lexer(grammar, name, tokens, scopes, rules, numRules, labelType="Token",
      filterMode) ::= <<
public class <name> extends Lexer {
genericParser(grammar, name, scopes, tokens, tokenNames, rules, numRules,
              bitsets, inputStreamType, superClass,
              ASTLabelType="Object", labelType, members) ::= <<
public class <name> extends <@superClassName><superClass><@end>

Remeber this only works when your parser will run with a JDK > 5.0

For C#, just suppress warnings in the @header. As far as I have seen, suppressing warning 0219 ("The variable ... is assigned but its value is never used") is sufficient, but you can of course suppress all warnings.

@header {
	#pragma warning disable 0219