[ 
https://issues.apache.org/jira/browse/GROOVY-8470?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xiaoguang Wang updated GROOVY-8470:
-----------------------------------
    Description: 
cat a.groovy
{code:java}
enum EnumA {

    EA(EnumB.EB)   // without a semicolon here, the groovyc enters dead loop

    enum EnumB { EB }
    private EnumA(EnumB enumB) {
    }
}
{code}
Run:

groovyc a.groovy

 

It hangs in:
{code:java}
"main" #1 prio=5 os_prio=31 tid=0x00007fc609803000 nid=0x1d03 runnable 
[0x00007000052af000]
   java.lang.Thread.State: RUNNABLE
    at 
org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumConstants(GroovyRecognizer.java:6575)
    at 
org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumBlock(GroovyRecognizer.java:5472)
    at 
org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumDefinition(GroovyRecognizer.java:2127)
    at 
org.codehaus.groovy.antlr.parser.GroovyRecognizer.typeDefinitionInternal(GroovyRecognizer.java:1875)
    at 
org.codehaus.groovy.antlr.parser.GroovyRecognizer.classField(GroovyRecognizer.java:5961)
    at 
org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumConstants(GroovyRecognizer.java:6443)
    at 
org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumBlock(GroovyRecognizer.java:5472)
    at 
org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumDefinition(GroovyRecognizer.java:2127)
    at 
org.codehaus.groovy.antlr.parser.GroovyRecognizer.typeDefinitionInternal(GroovyRecognizer.java:1875)
    at 
org.codehaus.groovy.antlr.parser.GroovyRecognizer.statement(GroovyRecognizer.java:1307)
    at 
org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:666)
    at 
org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:133)
    at 
org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:110)
    at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:234)
    at 
org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:168)
    at 
org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
    at 
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
    at 
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
    at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
    at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:537)
    at 
org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:61)
    at 
org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:217)
    at 
org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:150)
    at 
org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:180)
    at 
org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at 
org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
    at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
{code}
 

  was:
cat a.groovy
{code:java}
enum EnumA {

    EA(EnumB.EB)   // without a semicolon here, the groovyc enters dead loop

    enum EnumB { EB }
    private EnumA(EnumB enumB) {
    }
}
{code}
Run:

groovyc a.groovy

 

It hangs.

 

 


> dead loop when compiling 'enum in enum without semicolon'
> ---------------------------------------------------------
>
>                 Key: GROOVY-8470
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8470
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.13
>            Reporter: Xiaoguang Wang
>            Priority: Major
>
> cat a.groovy
> {code:java}
> enum EnumA {
>     EA(EnumB.EB)   // without a semicolon here, the groovyc enters dead loop
>     enum EnumB { EB }
>     private EnumA(EnumB enumB) {
>     }
> }
> {code}
> Run:
> groovyc a.groovy
>  
> It hangs in:
> {code:java}
> "main" #1 prio=5 os_prio=31 tid=0x00007fc609803000 nid=0x1d03 runnable 
> [0x00007000052af000]
>    java.lang.Thread.State: RUNNABLE
>     at 
> org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumConstants(GroovyRecognizer.java:6575)
>     at 
> org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumBlock(GroovyRecognizer.java:5472)
>     at 
> org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumDefinition(GroovyRecognizer.java:2127)
>     at 
> org.codehaus.groovy.antlr.parser.GroovyRecognizer.typeDefinitionInternal(GroovyRecognizer.java:1875)
>     at 
> org.codehaus.groovy.antlr.parser.GroovyRecognizer.classField(GroovyRecognizer.java:5961)
>     at 
> org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumConstants(GroovyRecognizer.java:6443)
>     at 
> org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumBlock(GroovyRecognizer.java:5472)
>     at 
> org.codehaus.groovy.antlr.parser.GroovyRecognizer.enumDefinition(GroovyRecognizer.java:2127)
>     at 
> org.codehaus.groovy.antlr.parser.GroovyRecognizer.typeDefinitionInternal(GroovyRecognizer.java:1875)
>     at 
> org.codehaus.groovy.antlr.parser.GroovyRecognizer.statement(GroovyRecognizer.java:1307)
>     at 
> org.codehaus.groovy.antlr.parser.GroovyRecognizer.compilationUnit(GroovyRecognizer.java:666)
>     at 
> org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:133)
>     at 
> org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:110)
>     at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:234)
>     at 
> org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:168)
>     at 
> org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:943)
>     at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:605)
>     at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
>     at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
>     at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:537)
>     at 
> org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:61)
>     at 
> org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:217)
>     at 
> org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:150)
>     at 
> org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:180)
>     at 
> org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:164)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke(Method.java:498)
>     at 
> org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
>     at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
> {code}
>  



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

Reply via email to