From 674471c0906dcb908b7d91bc0e3c062b06b6d496 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Tue, 31 Jul 2012 13:35:42 -0500 Subject: [PATCH] Add NotNull annotations, null check, tweak documentation --- tool/src/org/antlr/v4/automata/ATNVisitor.java | 2 +- .../src/org/antlr/v4/automata/ParserATNFactory.java | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tool/src/org/antlr/v4/automata/ATNVisitor.java b/tool/src/org/antlr/v4/automata/ATNVisitor.java index 6a07efcf2..5219d456f 100644 --- a/tool/src/org/antlr/v4/automata/ATNVisitor.java +++ b/tool/src/org/antlr/v4/automata/ATNVisitor.java @@ -57,5 +57,5 @@ public class ATNVisitor { } } - public void visitState(ATNState s) { } + public void visitState(@NotNull ATNState s) { } } diff --git a/tool/src/org/antlr/v4/automata/ParserATNFactory.java b/tool/src/org/antlr/v4/automata/ParserATNFactory.java index efc4921da..26e7c8faf 100644 --- a/tool/src/org/antlr/v4/automata/ParserATNFactory.java +++ b/tool/src/org/antlr/v4/automata/ParserATNFactory.java @@ -103,7 +103,14 @@ public class ParserATNFactory implements ATNFactory { public int currentOuterAlt; - public ParserATNFactory(@NotNull Grammar g) { this.g = g; atn = new ATN(); } + public ParserATNFactory(@NotNull Grammar g) { + if (g == null) { + throw new NullPointerException("g"); + } + + this.g = g; + this.atn = new ATN(); + } @Override public ATN createATN() { @@ -293,7 +300,7 @@ public class ParserATNFactory implements ATNFactory { /** Build what amounts to an epsilon transition with an action. * The action goes into ATN though it is ignored during prediction - * if actionIndex < 0. Only forced are executed during prediction. + * if actionIndex < 0. Only forced are executed during prediction. */ @Override public Handle action(ActionAST action) { @@ -328,7 +335,7 @@ public class ParserATNFactory implements ATNFactory { * begin/end. * * Special case: if just a list of tokens/chars/sets, then collapse - * to a single edge'd o-set->o graph. + * to a single edged o-set->o graph. * * TODO: Set alt number (1..n) in the states? */