1

using ANTLR4 with maven, Java8, I cannot compile generated sources. I tried several ANTLR versions (started with 4.7.1, but got the same Problem down to 4.3):

/C:/Users/me/GenX-2/src/common/target/generated-sources/antlr4/com/xxx/common/input/mqsc/MQSCParser.java:[1142,35] 
reset() in com.xxx.common.input.mqsc.MQSCParser cannot override reset() in org.antlr.v4.runtime.Parser
return type com.xxx.common.input.mqsc.MQSCParser.ResetContext is not compatible with void

and I can see from the Java class that the error itself is correct. Any idea how to change the generated source? The signature of the generated code at the point of problem is:

    public final ResetContext reset() throws RecognitionException {
Walter Kuhn
  • 479
  • 1
  • 6
  • 19

1 Answers1

2

reset() is a method in ANTLR's Parser class, so it cannot be a parser rule. You will need to rename it in your grammar to reset_stat or reset_, or some other name.

Bart Kiers
  • 166,582
  • 36
  • 299
  • 288