Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8598

Possible bug in AstBuilder Antlr4

    XMLWordPrintableJSON

Details

    Description

      From dev mailing list(http://groovy.329449.n5.nabble.com/Possible-bug-in-AstBuilder-Antlr4-tt5750881.html):

       
      Hi Daniel,

      I think I have found a bug in the antlr4 AstBuilder class.

      Add this line:

      import groovy.transform.CompileStatic

      before this one in a GString template: https://github.com/melix/groovy-core/blob/d9656842908acb403599cf574f509aea2737be47/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/classLevel/classDocName.html#L27

      And run GroovyDocToolTest. Some tests will fail with:

      java.lang.ClassCastException: org.codehaus.groovy.ast.ImportNode cannot be cast to org.codehaus.groovy.ast.stmt.Statement
          at org.apache.groovy.parser.antlr4.AstBuilder.visitBlockStatement(AstBuilder.java:4074)
          at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
          at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
          at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
          at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
          at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
          at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
          at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
          at org.apache.groovy.parser.antlr4.AstBuilder.visitBlockStatements(AstBuilder.java:4058)
          at org.apache.groovy.parser.antlr4.AstBuilder.visitBlockStatementsOpt(AstBuilder.java:4045)
          at org.apache.groovy.parser.antlr4.AstBuilder.visitClosure(AstBuilder.java:3715)
          at org.apache.groovy.parser.antlr4.AstBuilder.visitClosurePrmrAlt(AstBuilder.java:3120)
          at org.apache.groovy.parser.antlr4.AstBuilder.visitClosurePrmrAlt(AstBuilder.java:356)

      Attachments

        Activity

          People

            daniel_sun Daniel Sun
            daniel_sun Daniel Sun
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: