From bf5df307081c18805ec49f7007aff04de8a19334 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 9 Feb 2012 12:45:46 -0600 Subject: [PATCH] Remove unnecessary initializations, use isEmpty() instead of size()==0 --- .../org/antlr/v4/runtime/atn/ParserATNSimulator.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java b/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java index 51b31e458..2bd500ce0 100755 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/ParserATNSimulator.java @@ -367,7 +367,7 @@ public class ParserATNSimulator extends ATNSimulator { // if no edge, pop over to ATN interpreter, update DFA and return if ( s.edges == null || t >= s.edges.length || t < -1 || s.edges[t+1] == null ) { if ( dfa_debug && t>=0 ) System.out.println("no edge for "+parser.getTokenNames()[t]); - int alt = -1; + int alt; if ( dfa_debug ) { System.out.println("ATN exec upon "+ parser.getInputString(startIndex) + @@ -480,8 +480,8 @@ public class ParserATNSimulator extends ATNSimulator { ATN_failover++; ATNConfigSet previous = s0.configset; - DFAState D = null; - ATNConfigSet fullCtxSet = null; + DFAState D; + ATNConfigSet fullCtxSet; if ( debug ) System.out.println("s0 = "+s0); @@ -631,7 +631,7 @@ public class ParserATNSimulator extends ATNSimulator { if ( reach.hasSemanticContext ) { SemanticContext[] altToPred = getPredsForAmbigAlts(reach.conflictingAlts, reach, nalts); // altToPred[uniqueAlt] is now our validating predicate (if any) - List predPredictions = null; + List predPredictions; if ( altToPred!=null ) { // we have a validating predicate; test it predPredictions = getPredicatePredictions(reach.conflictingAlts, altToPred); @@ -793,7 +793,7 @@ public class ParserATNSimulator extends ATNSimulator { pairs.add(new DFAState.PredPrediction(pred, i)); } } - if ( pairs.size()==0 ) pairs = null; + if ( pairs.isEmpty() ) pairs = null; else if ( firstUnpredicated!=ATN.INVALID_ALT_NUMBER ) { // add default prediction if we found null predicate pairs.add(new DFAState.PredPrediction(null, firstUnpredicated));