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

dead loop when compiling 'enum in enum without semicolon'

    XMLWordPrintableJSON

Details

    Description

      cat a.groovy

      enum EnumA {
      
          EA(EnumB.EB)   // without a semicolon here, the groovyc enters dead loop
      
          enum EnumB { EB }
          private EnumA(EnumB enumB) {
          }
      }
      

      Run:

      groovyc a.groovy

       

      It hangs in:

      "main" #1 prio=5 os_prio=31 tid=0x00007fe32c001800 nid=0x2403 runnable [0x0000700008b92000]
         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)
      

       

      Attachments

        Activity

          People

            daniel_sun Daniel Sun
            wxiaoguang Xiaoguang Wang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: