[ https://issues.apache.org/jira/browse/GROOVY-7803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15226704#comment-15226704 ]
Shil Sinha commented on GROOVY-7803: ------------------------------------ Closing as a duplicate of GROOVY-7151. The fix will be in 2.5.0. > Java annotation with > --------------------- > > Key: GROOVY-7803 > URL: https://issues.apache.org/jira/browse/GROOVY-7803 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.4.6 > Reporter: wujek srujek > Priority: Critical > > The following annotation definition (defines a meta annotation for Spring > Boot integration tests > {code:java} > @Inherited > @Retention(RetentionPolicy.RUNTIME) > @Target(ElementType.TYPE) > @SpringApplicationConfiguration(classes = [Configuration, TestConfiguration]) > @WebIntegrationTest(randomPort = true) > @ActiveProfiles('integrationTest') > @TestExecutionListeners( > listeners = FlywayTestExecutionListener, > mergeMode = TestExecutionListeners.MergeMode.MERGE_WITH_DEFAULTS) > @interface ApplicationTest { > } > {code} > fails compilation with the following error messages: > {noformat} > ApplicationTest.groovy: 33: Annotation > @org.springframework.boot.test.SpringApplicationConfiguration is not allowed > on element ANNOTATION > @ line 33, column 1. > @SpringApplicationConfiguration(classes = [Configuration, > TestConfiguration]) > ^ > ApplicationTest.groovy: 34: Annotation > @org.springframework.boot.test.WebIntegrationTest is not allowed on element > ANNOTATION > @ line 34, column 1. > @WebIntegrationTest(randomPort = true) > ^ > ApplicationTest.groovy: 35: Annotation > @org.springframework.test.context.ActiveProfiles is not allowed on element > ANNOTATION > @ line 35, column 1. > @ActiveProfiles('integrationTest') > ^ > ApplicationTest.groovy: 36: Annotation > @org.springframework.test.context.TestExecutionListeners is not allowed on > element ANNOTATION > @ line 36, column 1. > @TestExecutionListeners( > ^ > {noformat} > (I omitted imports for brevity) > All of the annotations have `@Target(ElementType.TYPE)`, which according to > the documentation: > /** Class, interface (including annotation type), or enum declaration */ > Apparently, the Groovy compiler doesn't know that TYPE is also expected to > work on annotations. > This issue prevent a lot of annotations being written in Groovy. -- This message was sent by Atlassian JIRA (v6.3.4#6332)