Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Duplicate
-
2.4.6
-
None
-
None
Description
The following annotation definition (defines a meta annotation for Spring Boot integration tests
@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 { }
fails compilation with the following error messages:
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( ^
(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.
Attachments
Issue Links
- duplicates
-
GROOVY-7151 groovyc should accept meta annotation with ElementType.TYPE
- Closed