diff --git a/runtime/Java/src/org/antlr/v4/runtime/atn/LexerATNSimulator.java b/runtime/Java/src/org/antlr/v4/runtime/atn/LexerATNSimulator.java index 9b246d3b7..79c6c73e5 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/atn/LexerATNSimulator.java +++ b/runtime/Java/src/org/antlr/v4/runtime/atn/LexerATNSimulator.java @@ -103,7 +103,9 @@ public class LexerATNSimulator extends ATNSimulator { } public int match(CharStream input, int mode) { - match_calls++; + synchronized (LexerATNSimulator.class) { + match_calls++; + } this.mode = mode; int mark = input.mark(); try {