[ 
https://issues.apache.org/jira/browse/GROOVY-7814?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King closed GROOVY-7814.
-----------------------------
    Resolution: Won't Fix

There looked like cases where this would be useful but we have managed to avoid 
them for 10 years, so I'll close this for now. We can always reopen with a 
specific need if it arises.

> Consider allowing Groovy to support Arrays of arbitrary annotations as the 
> return type of an annotation definition member
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7814
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7814
>             Project: Groovy
>          Issue Type: New Feature
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>              Labels: annotations
>
> This feature suggestion is proposing to extend the allowable return types for 
> members in annotation definitions.
> {code}
> import java.lang.annotation.*
> @Retention(RetentionPolicy.RUNTIME)
> @Target([ElementType.TYPE])
> @interface AnyAnnotationCollection {
>     Annotation[] value()
> }
> {code}
> In this example, Java would require a specific annotation class instead of 
> just {{Annotation}}.
> Usage of the above annotation definition would look like:
> {code}
> @AnyAnnotationCollection([
>     @Grab('foo:bar:1.0'),
>     @AnyAnnotationCollection([
>         @FunctionalInterface,
>         @Deprecated
>     ])
> ])
> class Dummy{}
> assert Dummy.annotations[0].value().size() == 2
> assert Dummy.annotations[0].value()[1].value()[0].annotationType().simpleName 
> == 'FunctionalInterface'
> {code}
> The nesting here is not in any way required but supported.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to