[ https://issues.apache.org/jira/browse/GROOVY-11623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17945169#comment-17945169 ]
ASF GitHub Bot commented on GROOVY-11623: ----------------------------------------- eric-milles opened a new pull request, #2198: URL: https://github.com/apache/groovy/pull/2198 ```groovy String[] foo() { ['a','b','c' ] } ``` and ```groovy @interface A { String[] value() default [] } ``` > 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 > Assignee: Eric Milles > Priority: Minor > > 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)