Update several usages of @NotNull and @Nullable based on warnings from NullUsageProcessor

This commit is contained in:
Sam Harwell 2014-01-21 21:08:11 -06:00
parent d917ad46f7
commit 608c6a8a3a
6 changed files with 136 additions and 85 deletions

View File

@ -74,11 +74,11 @@ public interface ANTLRErrorListener {
* the parser was able to recover in line without exiting the * the parser was able to recover in line without exiting the
* surrounding rule. * surrounding rule.
*/ */
public void syntaxError(Recognizer<?, ?> recognizer, public void syntaxError(@NotNull Recognizer<?, ?> recognizer,
@Nullable Object offendingSymbol, @Nullable Object offendingSymbol,
int line, int line,
int charPositionInLine, int charPositionInLine,
String msg, @NotNull String msg,
@Nullable RecognitionException e); @Nullable RecognitionException e);
/** /**
@ -114,7 +114,7 @@ public interface ANTLRErrorListener {
int startIndex, int startIndex,
int stopIndex, int stopIndex,
boolean exact, boolean exact,
@NotNull BitSet ambigAlts, @Nullable BitSet ambigAlts,
@NotNull ATNConfigSet configs); @NotNull ATNConfigSet configs);
/** /**

View File

@ -31,6 +31,8 @@ package org.antlr.v4.runtime;
import org.antlr.v4.runtime.atn.ATNConfigSet; import org.antlr.v4.runtime.atn.ATNConfigSet;
import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.Nullable;
import java.util.BitSet; import java.util.BitSet;
@ -39,43 +41,43 @@ import java.util.BitSet;
*/ */
public class BaseErrorListener implements ANTLRErrorListener { public class BaseErrorListener implements ANTLRErrorListener {
@Override @Override
public void syntaxError(Recognizer<?, ?> recognizer, public void syntaxError(@NotNull Recognizer<?, ?> recognizer,
Object offendingSymbol, @Nullable Object offendingSymbol,
int line, int line,
int charPositionInLine, int charPositionInLine,
String msg, @NotNull String msg,
RecognitionException e) @Nullable RecognitionException e)
{ {
} }
@Override @Override
public void reportAmbiguity(Parser recognizer, public void reportAmbiguity(@NotNull Parser recognizer,
DFA dfa, @NotNull DFA dfa,
int startIndex, int startIndex,
int stopIndex, int stopIndex,
boolean exact, boolean exact,
BitSet ambigAlts, @Nullable BitSet ambigAlts,
ATNConfigSet configs) @NotNull ATNConfigSet configs)
{ {
} }
@Override @Override
public void reportAttemptingFullContext(Parser recognizer, public void reportAttemptingFullContext(@NotNull Parser recognizer,
DFA dfa, @NotNull DFA dfa,
int startIndex, int startIndex,
int stopIndex, int stopIndex,
BitSet conflictingAlts, @Nullable BitSet conflictingAlts,
ATNConfigSet configs) @NotNull ATNConfigSet configs)
{ {
} }
@Override @Override
public void reportContextSensitivity(Parser recognizer, public void reportContextSensitivity(@NotNull Parser recognizer,
DFA dfa, @NotNull DFA dfa,
int startIndex, int startIndex,
int stopIndex, int stopIndex,
int prediction, int prediction,
ATNConfigSet configs) @NotNull ATNConfigSet configs)
{ {
} }
} }

View File

@ -31,6 +31,8 @@ package org.antlr.v4.runtime;
import org.antlr.v4.runtime.atn.ATNConfigSet; import org.antlr.v4.runtime.atn.ATNConfigSet;
import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.Nullable;
import java.util.BitSet; import java.util.BitSet;
import java.util.Collection; import java.util.Collection;
@ -54,12 +56,12 @@ public class ProxyErrorListener implements ANTLRErrorListener {
} }
@Override @Override
public void syntaxError(Recognizer<?, ?> recognizer, public void syntaxError(@NotNull Recognizer<?, ?> recognizer,
Object offendingSymbol, @Nullable Object offendingSymbol,
int line, int line,
int charPositionInLine, int charPositionInLine,
String msg, @NotNull String msg,
RecognitionException e) @Nullable RecognitionException e)
{ {
for (ANTLRErrorListener listener : delegates) { for (ANTLRErrorListener listener : delegates) {
listener.syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e); listener.syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
@ -67,13 +69,13 @@ public class ProxyErrorListener implements ANTLRErrorListener {
} }
@Override @Override
public void reportAmbiguity(Parser recognizer, public void reportAmbiguity(@NotNull Parser recognizer,
DFA dfa, @NotNull DFA dfa,
int startIndex, int startIndex,
int stopIndex, int stopIndex,
boolean exact, boolean exact,
BitSet ambigAlts, @Nullable BitSet ambigAlts,
ATNConfigSet configs) @NotNull ATNConfigSet configs)
{ {
for (ANTLRErrorListener listener : delegates) { for (ANTLRErrorListener listener : delegates) {
listener.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs); listener.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
@ -81,12 +83,12 @@ public class ProxyErrorListener implements ANTLRErrorListener {
} }
@Override @Override
public void reportAttemptingFullContext(Parser recognizer, public void reportAttemptingFullContext(@NotNull Parser recognizer,
DFA dfa, @NotNull DFA dfa,
int startIndex, int startIndex,
int stopIndex, int stopIndex,
BitSet conflictingAlts, @Nullable BitSet conflictingAlts,
ATNConfigSet configs) @NotNull ATNConfigSet configs)
{ {
for (ANTLRErrorListener listener : delegates) { for (ANTLRErrorListener listener : delegates) {
listener.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs); listener.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
@ -94,12 +96,12 @@ public class ProxyErrorListener implements ANTLRErrorListener {
} }
@Override @Override
public void reportContextSensitivity(Parser recognizer, public void reportContextSensitivity(@NotNull Parser recognizer,
DFA dfa, @NotNull DFA dfa,
int startIndex, int startIndex,
int stopIndex, int stopIndex,
int prediction, int prediction,
ATNConfigSet configs) @NotNull ATNConfigSet configs)
{ {
for (ANTLRErrorListener listener : delegates) { for (ANTLRErrorListener listener : delegates) {
listener.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs); listener.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);

View File

@ -139,7 +139,7 @@ public class ATNConfigSet implements Set<ATNConfig> {
} }
@Override @Override
public boolean add(@NotNull ATNConfig config) { public boolean add(ATNConfig config) {
return add(config, null); return add(config, null);
} }

View File

@ -32,6 +32,7 @@ package org.antlr.v4.automata;
import org.antlr.v4.runtime.atn.ATN; import org.antlr.v4.runtime.atn.ATN;
import org.antlr.v4.runtime.atn.ATNState; import org.antlr.v4.runtime.atn.ATNState;
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.tool.ast.ActionAST; import org.antlr.v4.tool.ast.ActionAST;
import org.antlr.v4.tool.ast.BlockAST; import org.antlr.v4.tool.ast.BlockAST;
import org.antlr.v4.tool.ast.GrammarAST; import org.antlr.v4.tool.ast.GrammarAST;
@ -59,27 +60,36 @@ public interface ATNFactory {
} }
} }
@NotNull
ATN createATN(); ATN createATN();
void setCurrentRuleName(String name); void setCurrentRuleName(@NotNull String name);
void setCurrentOuterAlt(int alt); void setCurrentOuterAlt(int alt);
Handle rule(GrammarAST ruleAST, String name, Handle blk); @NotNull
Handle rule(@NotNull GrammarAST ruleAST, @NotNull String name, @NotNull Handle blk);
@NotNull
ATNState newState(); ATNState newState();
Handle label(Handle t); @NotNull
Handle label(@NotNull Handle t);
Handle listLabel(Handle t); @NotNull
Handle listLabel(@NotNull Handle t);
Handle tokenRef(TerminalAST node); @NotNull
Handle tokenRef(@NotNull TerminalAST node);
Handle set(GrammarAST associatedAST, List<GrammarAST> alts, boolean invert); @NotNull
Handle set(@NotNull GrammarAST associatedAST, @NotNull List<GrammarAST> alts, boolean invert);
Handle charSetLiteral(GrammarAST charSetAST); @NotNull
Handle charSetLiteral(@NotNull GrammarAST charSetAST);
Handle range(GrammarAST a, GrammarAST b); @NotNull
Handle range(@NotNull GrammarAST a, @NotNull GrammarAST b);
/** For a non-lexer, just build a simple token reference atom. /** For a non-lexer, just build a simple token reference atom.
* For a lexer, a string is a sequence of char to match. That is, * For a lexer, a string is a sequence of char to match. That is,
@ -87,7 +97,8 @@ public interface ATNFactory {
* the DFA. Machine== o-'f'->o-'o'->o-'g'->o and has n+1 states * the DFA. Machine== o-'f'->o-'o'->o-'g'->o and has n+1 states
* for n characters. * for n characters.
*/ */
Handle stringLiteral(TerminalAST stringLiteralAST); @NotNull
Handle stringLiteral(@NotNull TerminalAST stringLiteralAST);
/** For reference to rule r, build /** For reference to rule r, build
* *
@ -105,25 +116,31 @@ public interface ATNFactory {
* TODO add to codegen: collapse alt blks that are sets into single matchSet * TODO add to codegen: collapse alt blks that are sets into single matchSet
* @param node * @param node
*/ */
Handle ruleRef(GrammarAST node); @NotNull
Handle ruleRef(@NotNull GrammarAST node);
/** From an empty alternative build Grip o-e->o */ /** From an empty alternative build Grip o-e->o */
Handle epsilon(GrammarAST node); @NotNull
Handle epsilon(@NotNull GrammarAST node);
/** Build what amounts to an epsilon transition with a semantic /** Build what amounts to an epsilon transition with a semantic
* predicate action. The pred is a pointer into the AST of * predicate action. The pred is a pointer into the AST of
* the SEMPRED token. * the SEMPRED token.
*/ */
Handle sempred(PredAST pred); @NotNull
Handle sempred(@NotNull PredAST pred);
/** Build what amounts to an epsilon transition with an action. /** Build what amounts to an epsilon transition with an action.
* The action goes into ATN though it is ignored during analysis. * The action goes into ATN though it is ignored during analysis.
*/ */
Handle action(ActionAST action); @NotNull
Handle action(@NotNull ActionAST action);
Handle action(String action); @NotNull
Handle action(@NotNull String action);
Handle alt(List<Handle> els); @NotNull
Handle alt(@NotNull List<Handle> els);
/** From A|B|..|Z alternative block build /** From A|B|..|Z alternative block build
* *
@ -148,7 +165,8 @@ public interface ATNFactory {
* *
* Set alt number (1..n) in the left-Transition ATNState. * Set alt number (1..n) in the left-Transition ATNState.
*/ */
Handle block(BlockAST blockAST, GrammarAST ebnfRoot, List<Handle> alternativeGrips); @NotNull
Handle block(@NotNull BlockAST blockAST, @NotNull GrammarAST ebnfRoot, @NotNull List<Handle> alternativeGrips);
// Handle notBlock(GrammarAST blockAST, Handle set); // Handle notBlock(GrammarAST blockAST, Handle set);
@ -160,7 +178,8 @@ public interface ATNFactory {
* *
* or, if A is a block, just add an empty alt to the end of the block * or, if A is a block, just add an empty alt to the end of the block
*/ */
Handle optional(GrammarAST optAST, Handle blk); @NotNull
Handle optional(@NotNull GrammarAST optAST, @NotNull Handle blk);
/** From (A)+ build /** From (A)+ build
* *
@ -175,7 +194,8 @@ public interface ATNFactory {
* During analysis we'll call the follow link (transition 1) alt n+1 for * During analysis we'll call the follow link (transition 1) alt n+1 for
* an n-alt A block. * an n-alt A block.
*/ */
Handle plus(GrammarAST plusAST, Handle blk); @NotNull
Handle plus(@NotNull GrammarAST plusAST, @NotNull Handle blk);
/** From (A)* build /** From (A)* build
* *
@ -207,14 +227,19 @@ public interface ATNFactory {
* is sufficient to let me make an appropriate enter, exit, loop * is sufficient to let me make an appropriate enter, exit, loop
* determination. See codegen.g * determination. See codegen.g
*/ */
Handle star(GrammarAST starAST, Handle blk); @NotNull
Handle star(@NotNull GrammarAST starAST, @NotNull Handle blk);
/** Build an atom with all possible values in its label */ /** Build an atom with all possible values in its label */
Handle wildcard(GrammarAST associatedAST); @NotNull
Handle wildcard(@NotNull GrammarAST associatedAST);
Handle lexerAltCommands(ATNFactory.Handle alt, ATNFactory.Handle cmds); @NotNull
Handle lexerAltCommands(@NotNull Handle alt, @NotNull Handle cmds);
Handle lexerCallCommand(GrammarAST ID, GrammarAST arg); @NotNull
Handle lexerCallCommand(@NotNull GrammarAST ID, @NotNull GrammarAST arg);
Handle lexerCommand(GrammarAST ID); @NotNull
Handle lexerCommand(@NotNull GrammarAST ID);
} }

View File

@ -108,9 +108,11 @@ public class ParserATNFactory implements ATNFactory {
public int currentOuterAlt; public int currentOuterAlt;
@NotNull
protected final List<Triple<Rule, ATNState, ATNState>> preventEpsilonClosureBlocks = protected final List<Triple<Rule, ATNState, ATNState>> preventEpsilonClosureBlocks =
new ArrayList<Triple<Rule, ATNState, ATNState>>(); new ArrayList<Triple<Rule, ATNState, ATNState>>();
@NotNull
protected final List<Triple<Rule, ATNState, ATNState>> preventEpsilonOptionalBlocks = protected final List<Triple<Rule, ATNState, ATNState>> preventEpsilonOptionalBlocks =
new ArrayList<Triple<Rule, ATNState, ATNState>>(); new ArrayList<Triple<Rule, ATNState, ATNState>>();
@ -126,6 +128,7 @@ public class ParserATNFactory implements ATNFactory {
this.atn = new ATN(atnType, maxTokenType); this.atn = new ATN(atnType, maxTokenType);
} }
@NotNull
@Override @Override
public ATN createATN() { public ATN createATN() {
_createATN(g.rules.values()); _createATN(g.rules.values());
@ -167,7 +170,7 @@ public class ParserATNFactory implements ATNFactory {
return atn; return atn;
} }
protected void _createATN(Collection<Rule> rules) { protected void _createATN(@NotNull Collection<Rule> rules) {
createRuleStartAndStopATNStates(); createRuleStartAndStopATNStates();
GrammarASTAdaptor adaptor = new GrammarASTAdaptor(); GrammarASTAdaptor adaptor = new GrammarASTAdaptor();
@ -188,7 +191,7 @@ public class ParserATNFactory implements ATNFactory {
} }
@Override @Override
public void setCurrentRuleName(String name) { public void setCurrentRuleName(@NotNull String name) {
this.currentRule = g.getRule(name); this.currentRule = g.getRule(name);
} }
@ -198,8 +201,9 @@ public class ParserATNFactory implements ATNFactory {
} }
/* start->ruleblock->end */ /* start->ruleblock->end */
@NotNull
@Override @Override
public Handle rule(GrammarAST ruleAST, String name, Handle blk) { public Handle rule(@NotNull GrammarAST ruleAST, @NotNull String name, @NotNull Handle blk) {
Rule r = g.getRule(name); Rule r = g.getRule(name);
RuleStartState start = atn.ruleToStartState[r.index]; RuleStartState start = atn.ruleToStartState[r.index];
epsilon(start, blk.left); epsilon(start, blk.left);
@ -213,8 +217,9 @@ public class ParserATNFactory implements ATNFactory {
} }
/** From label {@code A} build graph {@code o-A->o}. */ /** From label {@code A} build graph {@code o-A->o}. */
@NotNull
@Override @Override
public Handle tokenRef(TerminalAST node) { public Handle tokenRef(@NotNull TerminalAST node) {
ATNState left = newState(node); ATNState left = newState(node);
ATNState right = newState(node); ATNState right = newState(node);
int ttype = g.getTokenType(node.getText()); int ttype = g.getTokenType(node.getText());
@ -227,8 +232,9 @@ public class ParserATNFactory implements ATNFactory {
* what an alt block looks like, must have extra state on left. * what an alt block looks like, must have extra state on left.
* This also handles {@code ~A}, converted to {@code ~{A}} set. * This also handles {@code ~A}, converted to {@code ~{A}} set.
*/ */
@NotNull
@Override @Override
public Handle set(GrammarAST associatedAST, List<GrammarAST> terminals, boolean invert) { public Handle set(@NotNull GrammarAST associatedAST, @NotNull List<GrammarAST> terminals, boolean invert) {
ATNState left = newState(associatedAST); ATNState left = newState(associatedAST);
ATNState right = newState(associatedAST); ATNState right = newState(associatedAST);
IntervalSet set = new IntervalSet(); IntervalSet set = new IntervalSet();
@ -247,12 +253,13 @@ public class ParserATNFactory implements ATNFactory {
} }
/** Not valid for non-lexers. */ /** Not valid for non-lexers. */
@NotNull
@Override @Override
public Handle range(GrammarAST a, GrammarAST b) { public Handle range(@NotNull GrammarAST a, @NotNull GrammarAST b) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException("This construct is not valid in parsers.");
} }
protected int getTokenType(GrammarAST atom) { protected int getTokenType(@NotNull GrammarAST atom) {
int ttype; int ttype;
if ( g.isLexer() ) { if ( g.isLexer() ) {
ttype = CharSupport.getCharValueFromGrammarCharLiteral(atom.getText()); ttype = CharSupport.getCharValueFromGrammarCharLiteral(atom.getText());
@ -264,14 +271,16 @@ public class ParserATNFactory implements ATNFactory {
} }
/** For a non-lexer, just build a simple token reference atom. */ /** For a non-lexer, just build a simple token reference atom. */
@NotNull
@Override @Override
public Handle stringLiteral(TerminalAST stringLiteralAST) { public Handle stringLiteral(@NotNull TerminalAST stringLiteralAST) {
return tokenRef(stringLiteralAST); return tokenRef(stringLiteralAST);
} }
/** {@code [Aa]} char sets not allowed in parser */ /** {@code [Aa]} char sets not allowed in parser */
@NotNull
@Override @Override
public Handle charSetLiteral(GrammarAST charSetAST) { public Handle charSetLiteral(@NotNull GrammarAST charSetAST) {
return null; return null;
} }
@ -286,13 +295,15 @@ public class ParserATNFactory implements ATNFactory {
* {@code o} is not linked to from rule ref state directly (uses * {@code o} is not linked to from rule ref state directly (uses
* {@link RuleTransition#followState}). * {@link RuleTransition#followState}).
*/ */
@NotNull
@Override @Override
public Handle ruleRef(GrammarAST node) { public Handle ruleRef(@NotNull GrammarAST node) {
Handle h = _ruleRef(node); Handle h = _ruleRef(node);
return h; return h;
} }
public Handle _ruleRef(GrammarAST node) { @NotNull
public Handle _ruleRef(@NotNull GrammarAST node) {
Rule r = g.getRule(node.getText()); Rule r = g.getRule(node.getText());
if ( r==null ) { if ( r==null ) {
g.tool.errMgr.toolError(ErrorType.INTERNAL_ERROR, "Rule "+node.getText()+" undefined"); g.tool.errMgr.toolError(ErrorType.INTERNAL_ERROR, "Rule "+node.getText()+" undefined");
@ -320,8 +331,9 @@ public class ParserATNFactory implements ATNFactory {
} }
/** From an empty alternative build {@code o-e->o}. */ /** From an empty alternative build {@code o-e->o}. */
@NotNull
@Override @Override
public Handle epsilon(GrammarAST node) { public Handle epsilon(@NotNull GrammarAST node) {
ATNState left = newState(node); ATNState left = newState(node);
ATNState right = newState(node); ATNState right = newState(node);
epsilon(left, right); epsilon(left, right);
@ -333,8 +345,9 @@ public class ParserATNFactory implements ATNFactory {
* predicate action. The {@code pred} is a pointer into the AST of * predicate action. The {@code pred} is a pointer into the AST of
* the {@link ANTLRParser#SEMPRED} token. * the {@link ANTLRParser#SEMPRED} token.
*/ */
@NotNull
@Override @Override
public Handle sempred(PredAST pred) { public Handle sempred(@NotNull PredAST pred) {
//System.out.println("sempred: "+ pred); //System.out.println("sempred: "+ pred);
ATNState left = newState(pred); ATNState left = newState(pred);
ATNState right = newState(pred); ATNState right = newState(pred);
@ -358,8 +371,9 @@ public class ParserATNFactory implements ATNFactory {
* The action goes into ATN though it is ignored during prediction * The action goes into ATN though it is ignored during prediction
* if {@link ActionTransition#actionIndex actionIndex}{@code <0}. * if {@link ActionTransition#actionIndex actionIndex}{@code <0}.
*/ */
@NotNull
@Override @Override
public Handle action(ActionAST action) { public Handle action(@NotNull ActionAST action) {
//System.out.println("action: "+action); //System.out.println("action: "+action);
ATNState left = newState(action); ATNState left = newState(action);
ATNState right = newState(action); ATNState right = newState(action);
@ -369,9 +383,10 @@ public class ParserATNFactory implements ATNFactory {
return new Handle(left, right); return new Handle(left, right);
} }
@NotNull
@Override @Override
public Handle action(String action) { public Handle action(@NotNull String action) {
return null; throw new UnsupportedOperationException("This element is not valid in parsers.");
} }
/** /**
@ -398,8 +413,9 @@ public class ParserATNFactory implements ATNFactory {
* <p/> * <p/>
* TODO: Set alt number (1..n) in the states? * TODO: Set alt number (1..n) in the states?
*/ */
@NotNull
@Override @Override
public Handle block(BlockAST blkAST, GrammarAST ebnfRoot, List<Handle> alts) { public Handle block(@NotNull BlockAST blkAST, @NotNull GrammarAST ebnfRoot, @NotNull List<Handle> alts) {
if ( ebnfRoot==null ) { if ( ebnfRoot==null ) {
if ( alts.size()==1 ) { if ( alts.size()==1 ) {
Handle h = alts.get(0); Handle h = alts.get(0);
@ -430,7 +446,8 @@ public class ParserATNFactory implements ATNFactory {
return null; return null;
} }
protected Handle makeBlock(BlockStartState start, BlockAST blkAST, List<Handle> alts) { @NotNull
protected Handle makeBlock(@NotNull BlockStartState start, @NotNull BlockAST blkAST, @NotNull List<Handle> alts) {
BlockEndState end = newState(BlockEndState.class, blkAST); BlockEndState end = newState(BlockEndState.class, blkAST);
start.endState = end; start.endState = end;
for (Handle alt : alts) { for (Handle alt : alts) {
@ -615,7 +632,7 @@ public class ParserATNFactory implements ATNFactory {
/** Build an atom with all possible values in its label. */ /** Build an atom with all possible values in its label. */
@NotNull @NotNull
@Override @Override
public Handle wildcard(GrammarAST node) { public Handle wildcard(@NotNull GrammarAST node) {
ATNState left = newState(node); ATNState left = newState(node);
ATNState right = newState(node); ATNState right = newState(node);
left.addTransition(new WildcardTransition(right)); left.addTransition(new WildcardTransition(right));
@ -685,13 +702,15 @@ public class ParserATNFactory implements ATNFactory {
return n; return n;
} }
@NotNull
@Override @Override
public Handle label(Handle t) { public Handle label(@NotNull Handle t) {
return t; return t;
} }
@NotNull
@Override @Override
public Handle listLabel(Handle t) { public Handle listLabel(@NotNull Handle t) {
return t; return t;
} }
@ -760,18 +779,21 @@ public class ParserATNFactory implements ATNFactory {
return false; return false;
} }
@NotNull
@Override @Override
public Handle lexerAltCommands(Handle alt, Handle cmds) { public Handle lexerAltCommands(@NotNull Handle alt, @NotNull Handle cmds) {
return null; throw new UnsupportedOperationException("This element is not allowed in parsers.");
} }
@NotNull
@Override @Override
public Handle lexerCallCommand(GrammarAST ID, GrammarAST arg) { public Handle lexerCallCommand(@NotNull GrammarAST ID, @NotNull GrammarAST arg) {
return null; throw new UnsupportedOperationException("This element is not allowed in parsers.");
} }
@NotNull
@Override @Override
public Handle lexerCommand(GrammarAST ID) { public Handle lexerCommand(@NotNull GrammarAST ID) {
return null; throw new UnsupportedOperationException("This element is not allowed in parsers.");
} }
} }