You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Shil Sinha (JIRA)" <ji...@apache.org> on 2016/04/05 19:24:25 UTC

[jira] [Closed] (GROOVY-7803) Java annotation with

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

Shil Sinha closed GROOVY-7803.
------------------------------
       Resolution: Duplicate
    Fix Version/s: 2.5.0-beta-1

> 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
>             Fix For: 2.5.0-beta-1
>
>
> 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)