public final void clearDFA() {
decisionToDFA = new DFA[decisionToState.size()];
for (int i = 0; i < decisionToDFA.length; i++) {
decisionToDFA[i] = new DFA(decisionToState.get(i), i);
}
the clearDFA function of ATN.java first reinitializes the DFA array and then assigns the value to array elements, due to this when parallel parsers are in use, calling clearDFA from one parser results in getting nullpointer exception in multithreaded scenarios
java.lang.NullPointerException: null
at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:367) ~[antlr4-runtime-4.9.0.jar:4.9.0]
at org.antlr.v4.runtime.atn.ParserATNSimulator.adaptivePredict(ParserATNSimulator.java:357) ~[antlr4-runtime-4.9.0.jar:4.9.0]
From the ANTLR main release branch i can see the clearDFA logic is written without the reinitilization of DFA array.. so whether this is a bug in the optimized fork ?
public final void clearDFA() {
for (int i = 0; i < decisionToDFA.length; i++) {
decisionToDFA[i] = new DFA(decisionToState.get(i), i);
}
@sharwell ,
i thought of customizing the clearDFA, but its defined as final method, any alternative way i can handle this issue without waiting for next release?
the clearDFA function of ATN.java first reinitializes the DFA array and then assigns the value to array elements, due to this when parallel parsers are in use, calling clearDFA from one parser results in getting nullpointer exception in multithreaded scenarios
From the ANTLR main release branch i can see the clearDFA logic is written without the reinitilization of DFA array.. so whether this is a bug in the optimized fork ?