Add a test case for GROOVY-6038: Ability to declare inner annotation types
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/da7501e3 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/da7501e3 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/da7501e3 Branch: refs/heads/master Commit: da7501e32f9dcb8714cb2adc3c38e0c0dd099908 Parents: 83e26af Author: sunlan <[email protected]> Authored: Wed Jan 25 01:10:22 2017 +0800 Committer: sunlan <[email protected]> Committed: Wed Jan 25 01:10:22 2017 +0800 ---------------------------------------------------------------------- .../groovy/parser/antlr4/GroovyParserTest.groovy | 1 + .../test/resources/bugs/BUG-GROOVY-6038.groovy | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/da7501e3/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy ---------------------------------------------------------------------- diff --git a/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy b/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy index 5cefbf9..4ef080b 100644 --- a/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy +++ b/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy @@ -345,5 +345,6 @@ class GroovyParserTest extends GroovyTestCase { doRunAndTest('bugs/BUG-GROOVY-5652.groovy'); doRunAndTest('bugs/BUG-GROOVY-4762.groovy'); doRunAndTest('bugs/BUG-GROOVY-4438.groovy'); + doRunAndTest('bugs/BUG-GROOVY-6038.groovy'); } } http://git-wip-us.apache.org/repos/asf/groovy/blob/da7501e3/subprojects/groovy-parser-antlr4/src/test/resources/bugs/BUG-GROOVY-6038.groovy ---------------------------------------------------------------------- diff --git a/subprojects/groovy-parser-antlr4/src/test/resources/bugs/BUG-GROOVY-6038.groovy b/subprojects/groovy-parser-antlr4/src/test/resources/bugs/BUG-GROOVY-6038.groovy new file mode 100644 index 0000000..0feb6e0 --- /dev/null +++ b/subprojects/groovy-parser-antlr4/src/test/resources/bugs/BUG-GROOVY-6038.groovy @@ -0,0 +1,19 @@ +import java.lang.annotation.* + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +@interface Upper { + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + @interface Inner { + String testInner() + } +} + +class X { + @Upper.Inner(testInner='abc') + def m() {} +} + +def m = X.class.declaredMethods.find { it.name == 'm' } +assert m.declaredAnnotations[0].testInner() == 'abc'
