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

JavaStubGenerator doesn't properly generate annotations with properties of array type

    XMLWordPrintableJSON

Details

    Description

      Annotation properties of array type are generated with null walue in java stubs. Subsequently, stub compilation fail.

      For example :

      // ArrayAnnotation.java
      public @interface ArrayAnnotation {
      String[] value() default {};
      }
      
      // AnnotatedClass.groovy
      @ArrayAnnotation(["foo", "bar"])
      class AnnotatedClass { }
      

      generates the stub :

      @ArrayAnnotation(value=null)
      public class AnnotatedClass extends java.lang.Object implements groovy.lang.GroovyObject {
      // irrelevent stuff removed
      }
      

      Compilation fails with the message :

      Compilation failure: \...\target\generated-sources\groovy-stubs\main\groovystubs\AnnotatedClass.java:[4,23] attribute value must be constant
      

      Attachments

        Activity

          People

            paulk Paul King
            gfouquet Gregory Fouquet
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: