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

Java8 does not load enum values into annotation attributes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.0-beta-2
    • 2.5.16, 3.0.10, 4.0.0-rc-1
    • Compiler
    • None

    Description

      Consider the following:

      @AnnotationCollector(mode = AnnotationCollectorMode.PREFER_EXPLICIT_MERGED)
      @interface Example {
      }
      
      @Example
      class Sample {
      }
      

      When the compiler accesses the annotations of a pre-compiled 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.

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: