groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] branch master updated: GROOVY-9051: The default constructor should be annotated with @Generated (add test)
Date Thu, 21 Mar 2019 21:59:12 GMT
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 0a94b12  GROOVY-9051: The default constructor should be annotated with @Generated
(add test)
0a94b12 is described below

commit 0a94b1293f985e7870aa231ba6fb346ea9d47ec5
Author: Paul King <paulk@asert.com.au>
AuthorDate: Fri Mar 22 07:58:59 2019 +1000

    GROOVY-9051: The default constructor should be annotated with @Generated (add test)
---
 ...nsformTest.groovy => GeneratedAnnotationTest.groovy} | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/test/org/codehaus/groovy/transform/GeneratedTransformTest.groovy b/src/test/org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy
similarity index 80%
rename from src/test/org/codehaus/groovy/transform/GeneratedTransformTest.groovy
rename to src/test/org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy
index 5823ae8..2896091 100644
--- a/src/test/org/codehaus/groovy/transform/GeneratedTransformTest.groovy
+++ b/src/test/org/codehaus/groovy/transform/GeneratedAnnotationTest.groovy
@@ -30,7 +30,7 @@ import org.junit.runners.JUnit4
  * Tests for the @Generated annotation.
  */
 @RunWith(JUnit4)
-class GeneratedTransformTest extends GroovyShellTestCase {
+class GeneratedAnnotationTest extends GroovyShellTestCase {
     @Rule public TestName nameRule = new TestName()
 
     @Before
@@ -59,7 +59,20 @@ class GeneratedTransformTest extends GroovyShellTestCase {
     }
 
     @Test
-    void testOverridenDefaultGroovyMethodsAreNotAnnotatedWithGenerated() {
+    void testDefaultConstructorIsAnnotatedWithGenerated() {
+        def person = evaluate('''
+            class Person {
+            }
+            new Person()
+        ''')
+
+        def cons = person.class.declaredConstructors
+        assert cons.size() == 1
+        assert cons[0].annotations*.annotationType().name.contains('groovy.transform.Generated')
+    }
+
+    @Test
+    void testOverriddenDefaultGroovyMethodsAreNotAnnotatedWithGenerated() {
         def person = evaluate('''
             class Person {
                 String name


Mime
View raw message