You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (JIRA)" <ji...@apache.org> on 2019/08/05 16:50:00 UTC
[jira] [Created] (GROOVY-9213) Parser runs (possibly) endless loop
for unclosed parenthesis followed by many expressions/statements
Eric Milles created GROOVY-9213:
-----------------------------------
Summary: Parser runs (possibly) endless loop for unclosed parenthesis followed by many expressions/statements
Key: GROOVY-9213
URL: https://issues.apache.org/jira/browse/GROOVY-9213
Project: Groovy
Issue Type: Documentation
Components: parser-antlr2, parser-antlr4
Reporter: Eric Milles
Consider the following:
{code:groovy}
int a = 0
// insert ( here instead of this comment and try to select anything below
a = 0
a = 0
a = 0
... (like 50 times)
{code}
With the unmatched parenthesis inserted at line 2, there is a loop in the parser looking for command arguments.
Here is a test case that demonstrates:
{code:groovy}
import groovy.transform.CompileStatic
import org.junit.Test
import static groovy.test.GroovyAssert.shouldFail
@CompileStatic
final class Groovy9999 {
@Test(timeout=15000L)
void testUnmatchedParenInLongScript() {
def err = shouldFail '''
int a = 0
(
''' + (' a = 0\n' * 50)
}
}
{code}
This is a problem for users editing Groovy scripts in the IDE: https://github.com/groovy/groovy-eclipse/issues/932
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)