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

Imported enum causes compilation bug preventing tests from compiling

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0-beta-1, 2.5.7, 2.4.17
    • Component/s: None
    • Labels:
      None
    • Environment:
      JDK 8
      groovy-all:2.4.+

      Description

      In early December our spock tests were compiling fine, but at the start of this year they're all breaking with the following error:

      Error:Groovyc: While compiling tests of REDACTED: BUG! exception in phase 'semantic analysis' in source unit 'REDACTEDSpec.groovy' Constructor parameter annotations length [5] does not match the parameter length: private REDACTEDENUMCLASS(java.lang.String,int,int,java.lang.String,ANOTHERREDACTEDENUMCLASS,java.lang.String,java.util.regex.Pattern)
          at org.codehaus.groovy.vmplugin.v5.Java5.getConstructorParameterAnnotations(Java5.java:438)
          at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:386)
          at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:280)
          at org.codehaus.groovy.ast.ClassNode.getDeclaredMethods(ClassNode.java:877)
          at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:892)
          at org.codehaus.groovy.ast.ClassNode.hasPossibleStaticMethod(ClassNode.java:1313)
          at org.codehaus.groovy.control.StaticImportVisitor.findStaticMethod(StaticImportVisitor.java:597)
          at org.codehaus.groovy.control.StaticImportVisitor.findStaticPropertyAccessorByFullName(StaticImportVisitor.java:565)
          at org.codehaus.groovy.control.StaticImportVisitor.findStaticPropertyAccessor(StaticImportVisitor.java:532)
          at org.codehaus.groovy.control.StaticImportVisitor.findStaticFieldOrPropAccessorImportFromModule(StaticImportVisitor.java:440)
          at org.codehaus.groovy.control.StaticImportVisitor.transformVariableExpression(StaticImportVisitor.java:198)
          at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:99)
          at org.codehaus.groovy.ast.expr.Expression.transformExpressions(Expression.java:51)
          at org.codehaus.groovy.ast.expr.ArgumentListExpression.transformExpression(ArgumentListExpression.java:69)
          at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:117)
          at org.codehaus.groovy.ast.expr.ConstructorCallExpression.transformExpression(ConstructorCallExpression.java:50)
          at org.codehaus.groovy.control.StaticImportVisitor.transformConstructorCallExpression(StaticImportVisitor.java:339)
          at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:114)
          at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitField(ClassCodeExpressionTransformer.java:70)
          at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1073)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
          at org.codehaus.groovy.control.StaticImportVisitor.visitClass(StaticImportVisitor.java:78)
          at org.codehaus.groovy.control.CompilationUnit$13.call(CompilationUnit.java:692)
          at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1087)
          at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)
          at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)
          at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
          at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62)
          at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:118)
          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.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:91)
          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.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:160)
          at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.lambda$runGroovyc$0(InProcessGroovyc.java:89)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)

      The thing it's complaining about appears to be when using one of our enums in a spock test.

        Attachments

        1. groovy-8953.zip
          0.6 kB
          Christoph Seibert

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                krhyscox Rhys Cox
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m