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 2021/11/09 15:44:00 UTC

[jira] [Created] (GROOVY-10352) Java8 does not load enum values into annotation attributes

Eric Milles created GROOVY-10352:
------------------------------------

             Summary: Java8 does not load enum values into annotation attributes
                 Key: GROOVY-10352
                 URL: https://issues.apache.org/jira/browse/GROOVY-10352
             Project: Groovy
          Issue Type: Improvement
          Components: Compiler
    Affects Versions: 4.0.0-beta-2
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
@AnnotationCollector(mode = AnnotationCollectorMode.PREFER_EXPLICIT_MERGED)
@interface Example {
}
{code}

{code:groovy}
@Example
class Sample {
}
{code}

When the compiler accesses the annotations of Example through the {{ClassNode}} Sample, the {{AnnotationCollector}} {{mode}} attribute is null.  This can be problematic for AST transformations which rely on the Groovy model for the annotation metadata.

In my real-world example, I had a {{record}} type, which has the implicit annotation {{RecordType}}.  When I added an explicit {{TupleConstructor}} annotation, the attributes were not merged, so I received duplicate processing of {{TupleConstructor}} and therefore duplicate constructors.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)