You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/07/03 12:44:00 UTC

[jira] [Created] (GROOVY-10677) Parser Bug

Paul King created GROOVY-10677:
----------------------------------

             Summary: Parser Bug
                 Key: GROOVY-10677
                 URL: https://issues.apache.org/jira/browse/GROOVY-10677
             Project: Groovy
          Issue Type: Bug
          Components: parser-antlr4
            Reporter: Paul King


For the following erroneous script (note opening triple quotes and closing single quote):
{code}
new GroovyShell().parse('''class Foo {}')
{code}
Parsing fails with this error:
{noformat}
1 compilation error:
Exception thrown
java.lang.StringIndexOutOfBoundsException: index 0,length 0
	at java.base/java.lang.String.checkIndex(String.java:3278)
	at java.base/java.lang.String.codePointAt(String.java:723)
	at org.apache.groovy.parser.antlr4.AstBuilder.validateExpressionListElement(AstBuilder.java:3225)
	at org.apache.groovy.parser.antlr4.AstBuilder.visitExpressionListElement(AstBuilder.java:3204)
	at org.apache.groovy.parser.antlr4.AstBuilder.visitEnhancedArgumentListElement(AstBuilder.java:2424)
...
	at org.apache.groovy.parser.antlr4.AstBuilder.visitEnhancedArgumentListInPar(AstBuilder.java:2369)
	at org.apache.groovy.parser.antlr4.AstBuilder.visitCommandExpression(AstBuilder.java:1878)     
{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)