Saravanan created GROOVY-11623:
----------------------------------

             Summary: Default values for array members in annotations
                 Key: GROOVY-11623
                 URL: https://issues.apache.org/jira/browse/GROOVY-11623
             Project: Groovy
          Issue Type: Bug
          Components: Compiler, Static compilation
    Affects Versions: 5.0.0-alpha-12
            Reporter: Saravanan


When using @CompileStatic, this code does not work


{code:java}
@Target({ ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface MyAnnotation { 
    Class<?>[] groups() default {}; 
    Class<? extends MyClazz>[] payloads() default {};   
}{code}
It causes 2 compile errors

"Cannot return value of type java.util.ArrayList<#E> for method returning 
java.lang.Class<?>[]" and
"Cannot return value of type java.util.ArrayList<#E> for method returning 
java.lang.Class<? extends MyClazz>[]"

 

It does not look like there is any way to express this when static compile is 
turned on



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to