You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2019/12/23 00:34:26 UTC

[groovy] 05/05: Tweak test

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

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

commit 98964b8e1a459e7645c7857793548f261b761db2
Author: Daniel.Sun <re...@hotmail.com>
AuthorDate: Mon Dec 23 08:04:06 2019 +0800

    Tweak test
    
    (cherry picked from commit b73e9398b7d55e65d6862412fa3f198893cdbec8)
---
 .../src/test/groovy/groovy/ant/Groovy9352Test.groovy | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/subprojects/groovy-ant/src/test/groovy/groovy/ant/Groovy9352Test.groovy b/subprojects/groovy-ant/src/test/groovy/groovy/ant/Groovy9352Test.groovy
index 566f86e..a53b60f 100644
--- a/subprojects/groovy-ant/src/test/groovy/groovy/ant/Groovy9352Test.groovy
+++ b/subprojects/groovy-ant/src/test/groovy/groovy/ant/Groovy9352Test.groovy
@@ -51,12 +51,15 @@ class Groovy9352Test extends AntTestCase {
                            private Gson gson;
                            private Gson gson2 = new SubGson();
                            private List<Gson> gsonList;
+                           @GsonAnnotation
                            private List<? extends Gson> gsonList2 = new ArrayList<SubGson>();
                            
+                           @GsonAnnotation
                            private Producer(Gson p) {}
                            private Producer(int p) throws Gson {}
                            private Producer() { gson = new Gson(); }
                            
+                           @GsonAnnotation
                            private void bar(Gson p) {}
                            private Gson bar() { return null;}
                            private void bar(int p) throws Gson {}
@@ -73,6 +76,18 @@ class Groovy9352Test extends AntTestCase {
                         class SubGson extends Gson {
                         }
                     ''')
+                    'GsonAnnotation.java'('''
+                        package p2;
+                        import java.lang.annotation.ElementType;
+                        import java.lang.annotation.Retention;
+                        import java.lang.annotation.RetentionPolicy;
+                        import java.lang.annotation.Target;
+                        
+                        @Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR})
+                        @Retention(RetentionPolicy.RUNTIME)
+                        @interface GsonAnnotation {
+                        }
+                    ''')
                 }
             }
 
@@ -84,11 +99,14 @@ class Groovy9352Test extends AntTestCase {
                 javac()
             }
 
-            // 2) delete `Gson` and `SubGson` related files: "Gson.java", "Gson.class", "SubGson.java" and "SubGson.class"
+            // 2) delete `Gson`, `SubGson`, `GsonAnnotation` related files:
+            // "Gson.java", "Gson.class", "SubGson.java", "SubGson.class", "GsonAnnotation.java", "GsonAnnotation.class"
             assert new File(ant.project.baseDir,"src/p2/Gson.java").delete()
             assert new File(ant.project.baseDir,"build/p2/Gson.class").delete()
             assert new File(ant.project.baseDir,"src/p2/SubGson.java").delete()
             assert new File(ant.project.baseDir,"build/p2/SubGson.class").delete()
+            assert new File(ant.project.baseDir,"src/p2/GsonAnnotation.java").delete()
+            assert new File(ant.project.baseDir,"build/p2/GsonAnnotation.class").delete()
 
             // 3) compile the Groovy source code
             ant.groovyc(srcdir: 'src', destdir: 'build', includes: 'p1/*')