GrammarASTWithOptions.getOptions never returns null

This commit is contained in:
Sam Harwell 2012-12-11 08:27:56 -06:00
parent f418ae6610
commit 70360a4ce8
2 changed files with 11 additions and 1 deletions

View File

@ -6,6 +6,7 @@ December 11, 2012
* "warning treated as error" is a one-off error
* Listen for issues reported by StringTemplate, report them as warnings
* Fix template issues
* GrammarASTWithOptions.getOptions never returns null
December 2, 2012

View File

@ -32,7 +32,9 @@ package org.antlr.v4.tool.ast;
import org.antlr.runtime.Token;
import org.antlr.v4.misc.CharSupport;
import org.antlr.v4.runtime.misc.NotNull;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@ -84,5 +86,12 @@ public abstract class GrammarASTWithOptions extends GrammarAST {
@Override
public abstract GrammarASTWithOptions dupNode();
public Map<String, GrammarAST> getOptions() { return options; }
@NotNull
public Map<String, GrammarAST> getOptions() {
if (options == null) {
return Collections.emptyMap();
}
return options;
}
}