You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/05/23 07:37:00 UTC

[jira] [Created] (GROOVY-8598) Possible bug in AstBuilder Antlr4

Daniel Sun created GROOVY-8598:
----------------------------------

             Summary: Possible bug in AstBuilder Antlr4
                 Key: GROOVY-8598
                 URL: https://issues.apache.org/jira/browse/GROOVY-8598
             Project: Groovy
          Issue Type: Bug
          Components: parser-antlr4
            Reporter: Daniel Sun
            Assignee: Daniel Sun
             Fix For: 2.6.0-alpha-4, 3.0.0-alpha-3


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)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)