You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding an element to a collection inside a method that creates a rule, a NullPointerException occurs during "createParser".
Example:
packagetest;
importjava.util.LinkedHashMap;
importjava.util.LinkedList;
importjava.util.List;
importjava.util.Map;
importorg.parboiled.Parboiled;
importorg.parboiled.Rule;
importorg.parboiled.support.Var;
importcom.github.parboiled1.grappa.parsers.EventBusParser;
publicclassNpeOnMap {
publicstaticvoidmain(String[] args) {
TestParserparser = Parboiled.createParser(TestParser.class);
}
publicstaticclassTestParserextendsEventBusParser<String> {
Rulerelativity() {
finalMap<String, String> map = newLinkedHashMap<>();
// map.put("x", "y"); // NPEfinalList<String> list = newLinkedList<>();
// list.add("x"); // NPEVar<String> m = newVar<>();
returnsequence("a", m.set(match()));
// return sequence("a", "b"); // No NPE in any case
}
}
}
The NPE only occurs when using "match()" inside the returned rule. If no "match()" is used, then any other code works fine.
StackTrace:
Exception in thread "main" java.lang.RuntimeException: Error creating extended parser class: null
at org.parboiled.Parboiled.createParser(Parboiled.java:75)
at test.NpeOnMap.main(NpeOnMap.java:17)
Caused by: java.lang.NullPointerException
at org.parboiled.transform.process.ImplicitActionsConverter.getDependents(ImplicitActionsConverter.java:180)
at org.parboiled.transform.process.ImplicitActionsConverter.isImplicitAction(ImplicitActionsConverter.java:110)
at org.parboiled.transform.process.ImplicitActionsConverter.walkNode(ImplicitActionsConverter.java:83)
at org.parboiled.transform.process.ImplicitActionsConverter.walkNode(ImplicitActionsConverter.java:92)
at org.parboiled.transform.process.ImplicitActionsConverter.walkNode(ImplicitActionsConverter.java:92)
at org.parboiled.transform.process.ImplicitActionsConverter.process(ImplicitActionsConverter.java:73)
at org.parboiled.transform.ParserTransformer.runMethodTransformers(ParserTransformer.java:122)
at org.parboiled.transform.ParserTransformer.extendParserClass(ParserTransformer.java:98)
at org.parboiled.transform.ParserTransformer.transformParser(ParserTransformer.java:66)
at org.parboiled.Parboiled.createParser(Parboiled.java:67)
... 1 more
The text was updated successfully, but these errors were encountered:
When adding an element to a collection inside a method that creates a rule, a NullPointerException occurs during "createParser".
Example:
The NPE only occurs when using "match()" inside the returned rule. If no "match()" is used, then any other code works fine.
StackTrace:
The text was updated successfully, but these errors were encountered: