It is used nowhere but imports java.awt.*; Android runtime
has no java.awt.* so Android SDK build tools say "it includes
invalid packages". It's better if antlr4-runtime has no dependency
on java.awt.*, esp. it is not used anymore.
LexerActionExecutor caches its hash string in a member called
'hashString'. However, the class also has a method with the
same name which leads to unexpected results.
The member has been renamed to '_hashString' to avoid the name
clash.
The PredictionContext should be passed to the ATNConfig constructor
in the first argument, the params object. Instead, it is being passed
as the second argument which is intended to be the config.
The parameter `RuleFunction rf` in `ActionTranslater#translateActionChunk` may be `null`.
The method's implementation takes care of this by checking `rf` before making its `ruleCtx` the translator's nodeContext:
```
if ( rf!=null ) translator.nodeContext = rf.ruleCtx;
```
However in the statement following this code the check for `rf!=null` is missing. This will lead to a `NullPointerException` when `altLabel` is defined and `rf` is `null`:
```
if ( altLabel!=null ) translator.nodeContext = rf.altLabelCtxs.get(altLabel);
```
To avoid the problem only access `rf.altLabelCtxs` when `rf` is not null:
```
if ( rf!=null ) {
translator.nodeContext = rf.ruleCtx;
if ( altLabel!=null ) translator.nodeContext = rf.altLabelCtxs.get(altLabel);
}
```
After loading and casting the parserClass in TestRig#process using
`cl.loadClass(parserName).asSubclass(Parser.class)` there is a check if
the class returned by `#asSubclass` is not null:
```
parserClass = cl.loadClass(parserName).asSubclass(Parser.class);
if ( parserClass==null ) {
System.err.println("Can't load "+parserName);
}
```
The method `#asSubclass` will never return `null`, but throw an
`ClassCastException` when the cast is not valid, therefore the check
can be removed.
See also: [TestRig#process Documentation](http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#asSubclass(java.lang.Class\))