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

Annotation collection isn't properly handling enum annotation attribute values

    XMLWordPrintableJSON

Details

    Description

      The easiest way to reproduce is to change the definition of `Immutable`.

       Change the line:

      @TupleConstructor(defaults = false)
      

      to:

      @TupleConstructor(defaultsMode = DefaultsMode.OFF)
      

      The first error is to do with stub generation:

      subprojects/groovy-macro/build/tmp/compileGroovy/groovy-java-stubs/org/codehaus/groovy/macro/matcher/MatchingConstraints.java:3: error: incompatible types: String cannot be converted to DefaultsMode
      @groovy.transform.CompileStatic() @groovy.transform.ToString(includeSuperProperties=true, cache=true) @groovy.transform.EqualsAndHashCode(cache=true) @groovy.transform.ImmutableBase() @groovy.transform.Final() @groovy.transform.ImmutableOptions(knownImmutableClasses={org.codehaus.groovy.macro.matcher.internal.ConstraintPredicate.class}) @groovy.transform.PropertyOptions(propertyHandler=groovy.transform.options.ImmutablePropertyHandler.class) @groovy.transform.TupleConstructor(defaultsMode="OFF") @groovy.transform.MapConstructor(noArg=true, includeSuperProperties=true, includeFields=true) @groovy.transform.KnownImmutable() public class MatchingConstraints
                                                                                                                                                                                                                                                                                                                                                                              
                    ^
      1 error
      startup failed:
      Compilation failed; see the compiler error output for details.
      

      Once that is fixed, the next error surfaces which is once the `compileTestGroovy` task is executed:

      General error during instruction selection: Cannot generate bytecode for constant: OFF of type: groovy.transform.DefaultsMode
      
      org.codehaus.groovy.classgen.ClassGeneratorException: Cannot generate bytecode for constant: OFF of type: groovy.transform.DefaultsMode
              at org.codehaus.groovy.classgen.asm.OperandStack.pushConstant(OperandStack.java:513)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstantExpression(AsmClassGenerator.java:897)
              at org.codehaus.groovy.ast.expr.ConstantExpression.visit(ConstantExpression.java:82)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitMapExpression(AsmClassGenerator.java:1615)
              at org.codehaus.groovy.ast.expr.MapExpression.visit(MapExpression.java:54)
      ...
      

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              paulk Paul King
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: