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 2023/05/17 11:56:00 UTC
[jira] [Commented] (GROOVY-11062) Annotation collection isn't properly handling enum annotation attribute values
[ https://issues.apache.org/jira/browse/GROOVY-11062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17723425#comment-17723425 ]
Eric Milles commented on GROOVY-11062:
--------------------------------------
defaults and defaultsMode are not considered together. I have a bit of code to look at DefaultsMode in unresolved situation. You can hav a look at groovy-eclipse repository’s base folder. I’ll link when I get to my pc.
> Annotation collection isn't properly handling enum annotation attribute values
> ------------------------------------------------------------------------------
>
> Key: GROOVY-11062
> URL: https://issues.apache.org/jira/browse/GROOVY-11062
> Project: Groovy
> Issue Type: Bug
> Components: class generator, Stub generator / Joint compiler
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
>
> The easiest way to reproduce is to change the definition of `Immutable`.
> Change the line:
> {code}
> @TupleConstructor(defaults = false)
> {code}
> to:
> {code}
> @TupleConstructor(defaultsMode = DefaultsMode.OFF)
> {code}
> The first error is to do with stub generation:
> {noformat}
> 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.
> {noformat}
> Once that is fixed, the next error surfaces which is once the `compileTestGroovy` task is executed:
> {noformat}
> 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)
> ...
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)