You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2022/01/21 04:07:47 UTC

[groovy] branch master updated: GROOVY-7033: slight tweak to test (check TYPE_USE case also)

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new da55697  GROOVY-7033: slight tweak to test (check TYPE_USE case also)
da55697 is described below

commit da556979db9fa08a61cff7139914fbda169f4c5d
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri Jan 21 14:07:40 2022 +1000

    GROOVY-7033: slight tweak to test (check TYPE_USE case also)
---
 .../annotations/closures/AnnotationClosureTest.groovy  | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/test/gls/annotations/closures/AnnotationClosureTest.groovy b/src/test/gls/annotations/closures/AnnotationClosureTest.groovy
index 3d72be2..ba3a902 100644
--- a/src/test/gls/annotations/closures/AnnotationClosureTest.groovy
+++ b/src/test/gls/annotations/closures/AnnotationClosureTest.groovy
@@ -161,15 +161,23 @@ final class AnnotationClosureTest extends CompilableTestSupport {
 
             @Target(ElementType.METHOD)
             @Retention(RetentionPolicy.RUNTIME)
-            @interface Tag { Class<?> value() }
+            @interface MethodAnno { Class<?> value() }
 
-            def obj = new Object() {
-                @Tag(value = { -> })
+            @Target(ElementType.TYPE_USE)
+            @Retention(RetentionPolicy.RUNTIME)
+            @interface TypeUseAnno { Class<?> value() }
+
+            def aic = new Object() {
+                @MethodAnno(value = { -> })
+                @TypeUseAnno(value = { -> })
                 String toString() {}
             }
 
-            Annotation ann = obj.class.getMethod('toString').annotations[0]
-            assert ann.annotationType().name == 'Tag'
+            def toString = aic.class.getMethod('toString')
+            Annotation ann = toString.annotations[0]
+            assert ann.annotationType().name == 'MethodAnno'
+            ann = toString.annotatedReturnType.annotations[0]
+            assert ann.annotationType().name == 'TypeUseAnno'
         '''
     }
 }