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 2019/08/20 08:55:17 UTC

[groovy] branch GROOVY_2_5_X updated (83532a0 -> fd1f9d6)

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

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


    from 83532a0  Revert "GROOVY-9031: correct trait property generics before writing stub methods" for now
     new 5d1768b  GROOVY-4993: add @since tag to javadoc
     new a755019  formatting and convert test to JUnit4
     new fd1f9d6  GROOVY-9231: typo in package name for TypeChecked in semantics adoc

The 3 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:
 src/main/groovy/groovy/transform/Memoized.java |   2 +
 src/spec/doc/core-semantics.adoc               |   4 +-
 src/test/groovy/bugs/Groovy4418Bug.groovy      | 137 +++++++++++++------------
 3 files changed, 77 insertions(+), 66 deletions(-)


[groovy] 02/03: formatting and convert test to JUnit4

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

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

commit a755019116b2e621d46ea3cd48a16ca763c0795c
Author: Paul King <pa...@asert.com.au>
AuthorDate: Mon Aug 19 15:52:27 2019 +1000

    formatting and convert test to JUnit4
---
 src/test/groovy/bugs/Groovy4418Bug.groovy | 137 ++++++++++++++++--------------
 1 file changed, 73 insertions(+), 64 deletions(-)

diff --git a/src/test/groovy/bugs/Groovy4418Bug.groovy b/src/test/groovy/bugs/Groovy4418Bug.groovy
index 3e8a93c..33fe40b 100644
--- a/src/test/groovy/bugs/Groovy4418Bug.groovy
+++ b/src/test/groovy/bugs/Groovy4418Bug.groovy
@@ -18,9 +18,14 @@
  */
 package groovy.bugs
 
-import gls.CompilableTestSupport
+import org.junit.Test
 
-class Groovy4418Bug extends CompilableTestSupport {
+import static groovy.test.GroovyAssert.assertScript
+import static groovy.util.GroovyAssert.shouldFail
+
+final class Groovy4418Bug {
+
+    @Test
     void testStaticFieldAccess() {
         assertScript '''
             class Base {
@@ -35,31 +40,31 @@ class Groovy4418Bug extends CompilableTestSupport {
         '''
     }
 
-    // additional test for GROOVY-6183
+    @Test // GROOVY-6183
     void testStaticAttributeAccess() {
         assertScript '''
-        class A {
-            static protected int x
-            public static void reset() { this.@x = 2 }
-        }
-        assert A.x == 0
-        assert A.@x == 0
-        A.reset()
-        assert A.x == 2
-        assert A.@x == 2
+            class A {
+                static protected int x
+                public static void reset() { this.@x = 2 }
+            }
+            assert A.x == 0
+            assert A.@x == 0
+            A.reset()
+            assert A.x == 2
+            assert A.@x == 2
         '''
     }
 
-    // GROOVY-8385
-    void testParentClassStaticAttributeSetAccessShouldNotCallSetter() {
+    @Test // GROOVY-8385
+    void testParentClassStaticAttributeSetAccess() {
         assertScript '''
             class A {
                 static protected p
-                static setP(){def val}
-                static getP(){this.@p}
+                static setP(def val){ p = 2 }
+                static getP(){ -1 }
             }
             class B extends A {
-              def m(){this.@p = 1}
+                def m(){ this.@p = 1 }
             }
             def x = new B()
             assert A.@p == null
@@ -70,11 +75,11 @@ class Groovy4418Bug extends CompilableTestSupport {
         assertScript '''
             class A {
                 static protected p
-                static setP(){def val}
-                static getP(){this.@p}
+                static setP(def val){ p = 2 }
+                static getP(){ -1 }
             }
             class B extends A {
-              def m(){super.@p = 1}
+                def m(){ super.@p = 1 }
             }
             def x = new B()
             assert A.@p == null
@@ -85,12 +90,12 @@ class Groovy4418Bug extends CompilableTestSupport {
         assertScript '''
             class A {
                 static protected p
-                static setP(){def val}
-                static getP(){this.@p}
+                static setP(def val){ p = 2 }
+                static getP(){ -1 }
             }
             class AA extends A {}
             class B extends AA {
-              def m(){super.@p = 1}
+                def m(){ super.@p = 1 }
             }
             def x = new B()
             assert A.@p == null
@@ -99,16 +104,16 @@ class Groovy4418Bug extends CompilableTestSupport {
         '''
     }
 
-    // GROOVY-8385
-    void testParentClassNonStaticAttributeSetAccessShouldNotCallSetter() {
+    @Test // GROOVY-8385
+    void testParentClassNonStaticAttributeSetAccess() {
         assertScript '''
             class A {
                 protected p
-                void setP(def val){}
-                def getP(){p}
+                void setP(def val) { p = 2 }
+                def getP() { -1 }
             }
             class B extends A {
-              def m(){this.@p = 1}
+                def m() { this.@p = 1 }
             }
             def x = new B()
             assert x.@p == null
@@ -119,11 +124,11 @@ class Groovy4418Bug extends CompilableTestSupport {
         assertScript '''
             class A {
                 protected p
-                void setP(def val){}
-                def getP(){p}
+                void setP(def val) { p = 2 }
+                def getP() { -1 }
             }
             class B extends A {
-              def m(){super.@p = 1}
+                def m() { super.@p = 1 }
             }
             def x = new B()
             assert x.@p == null
@@ -134,12 +139,12 @@ class Groovy4418Bug extends CompilableTestSupport {
         assertScript '''
             class A {
                 protected p
-                void setP(def val){}
-                def getP(){p}
+                void setP(def val) { p = 2 }
+                def getP() { -1 }
             }
             class AA extends A {}
             class B extends AA {
-              def m(){super.@p = 1}
+                def m() { super.@p = 1 }
             }
             def x = new B()
             assert x.@p == null
@@ -148,39 +153,43 @@ class Groovy4418Bug extends CompilableTestSupport {
         '''
     }
 
-    // GROOVY-8385
+    @Test // GROOVY-8385
     void testParentClassPrivateStaticAttributeSetAccessShouldCallSetter() {
-        shouldFail(MissingFieldException, '''
-            class A {
-                static private p
-                static setP(){def val}
-                static getP(){this.@p}
-            }
-            class B extends A {
-              def m(){this.@p = 1}
-            }
-            def x = new B()
-            assert A.@p == null
-            x.m()
-        ''')
+        shouldFail(MissingFieldException) {
+            Eval.me'''
+                class A {
+                    static private p
+    
+                    void setP(def val) { p = 2 }
+    
+                    def getP() { -1 }
+                }
+                class B extends A {
+                    def m() { this.@p = 1 }
+                }
+                def x = new B()
+                assert A.@p == null
+                x.m()
+            '''
+        }
     }
 
-    // GROOVY-8385
+    @Test // GROOVY-8385
     void testParentClassPrivateNonStaticAttributeSetAccessShouldNotCallSetter() {
-        shouldFail(MissingFieldException, '''
-            class A {
-                private p
-                void setP(def val){}
-                def getP(){p}
-            }
-            class B extends A {
-              def m(){this.@p = 1}
-            }
-            def x = new B()
-            assert x.@p == null
-            x.m()
-        ''')
+        shouldFail(MissingFieldException) {
+            Eval.me'''
+                class A {
+                    private p
+                    void setP(def val) { p = 2 }
+                    def getP() { -1 }
+                }
+                class B extends A {
+                    def m() { this.@p = 1 }
+                }
+                def x = new B()
+                assert x.@p == null
+                x.m()
+        '''
+        }
     }
-
-
 }


[groovy] 03/03: GROOVY-9231: typo in package name for TypeChecked in semantics adoc

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

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

commit fd1f9d6435911c931db810b82684089a1ad33b0e
Author: Paul King <pa...@asert.com.au>
AuthorDate: Tue Aug 20 18:50:52 2019 +1000

    GROOVY-9231: typo in package name for TypeChecked in semantics adoc
---
 src/spec/doc/core-semantics.adoc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/spec/doc/core-semantics.adoc b/src/spec/doc/core-semantics.adoc
index 1fef521..7c2d562 100644
--- a/src/spec/doc/core-semantics.adoc
+++ b/src/spec/doc/core-semantics.adoc
@@ -939,7 +939,7 @@ manual.
 However, if your program doesn't rely on dynamic features and that you come from the static world (in particular, from
 a Java mindset), not catching such "errors" at compile time can be surprising. As we have seen in the previous example,
 the compiler cannot be sure this is an error. To make it aware that it is, you have to explicitly instruct the compiler
-that you are switching to a type checked mode. This can be done by annotating a class or a method with `@groovy.lang.TypeChecked`.
+that you are switching to a type checked mode. This can be done by annotating a class or a method with `@groovy.transform.TypeChecked`.
 
 When type checking is activated, the compiler performs much more work:
 
@@ -956,7 +956,7 @@ In this section, we will describe the behavior of the type checker in various si
 
 ===== Activating type checking at compile time
 
-The `groovy.lang.TypeChecked` annotation enabled type checking. It can be placed on a class:
+The `groovy.transform.TypeChecked` annotation enables type checking. It can be placed on a class:
 
 [source,groovy]
 ----


[groovy] 01/03: GROOVY-4993: add @since tag to javadoc

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

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

commit 5d1768b0830e1a449ae98ac759465cebf8b03d5d
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri Aug 16 21:30:41 2019 +1000

    GROOVY-4993: add @since tag to javadoc
---
 src/main/groovy/groovy/transform/Memoized.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/groovy/groovy/transform/Memoized.java b/src/main/groovy/groovy/transform/Memoized.java
index 051cd81..6ba204d 100644
--- a/src/main/groovy/groovy/transform/Memoized.java
+++ b/src/main/groovy/groovy/transform/Memoized.java
@@ -124,6 +124,8 @@ import java.lang.annotation.Target;
  * // increment is invoked so incrementChange is true.
  * assert incrementChange
  * </pre>
+ *
+ * @since 2.2.0
  */
 @java.lang.annotation.Documented
 @Retention(RetentionPolicy.SOURCE)