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:09:13 UTC

[groovy] branch GROOVY_4_0_X updated (84d159d -> 97ed4a1)

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

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


    from 84d159d  GROOVY-7033: visit AIC's field, method, and parameter annotations
     new 0a122da  GROOVY-7033: slight tweak to test
     new 97ed4a1  GROOVY-7033: slight tweak to test (check TYPE_USE case also)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../annotations/closures/AnnotationClosureTest.groovy | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

[groovy] 01/02: GROOVY-7033: slight tweak to test

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0a122da1158c3db643b366625097d33674f8ccdc
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri Jan 21 10:55:40 2022 +1000

    GROOVY-7033: slight tweak to test
---
 src/test/gls/annotations/closures/AnnotationClosureTest.groovy | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/test/gls/annotations/closures/AnnotationClosureTest.groovy b/src/test/gls/annotations/closures/AnnotationClosureTest.groovy
index dee473a..3d72be2 100644
--- a/src/test/gls/annotations/closures/AnnotationClosureTest.groovy
+++ b/src/test/gls/annotations/closures/AnnotationClosureTest.groovy
@@ -156,17 +156,20 @@ final class AnnotationClosureTest extends CompilableTestSupport {
 
     // GROOVY-7033
     void testAnnotationOnAnonymousInnerClassMethod() {
-        shouldCompile '''
+        assertScript '''
             import java.lang.annotation.*
 
             @Target(ElementType.METHOD)
             @Retention(RetentionPolicy.RUNTIME)
             @interface Tag { Class<?> value() }
 
-            return new Object() {
+            def obj = new Object() {
                 @Tag(value = { -> })
                 String toString() {}
             }
+
+            Annotation ann = obj.class.getMethod('toString').annotations[0]
+            assert ann.annotationType().name == 'Tag'
         '''
     }
 }

[groovy] 02/02: GROOVY-7033: slight tweak to test (check TYPE_USE case also)

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 97ed4a177be75c22c2cee0e6e158731531a6daea
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'
         '''
     }
 }