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 2020/04/19 04:52:09 UTC

[groovy] branch GROOVY_3_0_X updated (4e1bfda -> e6c4f14)

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

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


    from 4e1bfda  Trivial refactoring: Anonymous type can be replaced with lambda
     new 356c328  Trivial refactoring: make constants final
     new e6c4f14  Check types in the test for `unaryMinus`

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:
 src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java |  4 ++--
 src/test/groovy/bugs/Groovy4414Bug.groovy                    | 11 ++++++++---
 2 files changed, 10 insertions(+), 5 deletions(-)


[groovy] 02/02: Check types in the test for `unaryMinus`

Posted by su...@apache.org.
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 e6c4f142306b4f807871f8cbd50235d68c19c650
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Apr 19 12:49:01 2020 +0800

    Check types in the test for `unaryMinus`
    
    (cherry picked from commit 0104ca086a2fa8c6f46369c53883fb1658cbb004)
---
 src/test/groovy/bugs/Groovy4414Bug.groovy | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/test/groovy/bugs/Groovy4414Bug.groovy b/src/test/groovy/bugs/Groovy4414Bug.groovy
index dfa9148..8e779da 100644
--- a/src/test/groovy/bugs/Groovy4414Bug.groovy
+++ b/src/test/groovy/bugs/Groovy4414Bug.groovy
@@ -43,9 +43,14 @@ class Groovy4414Bug extends GroovyTestCase {
         }};
         
         assertEquals(expected, InvokerHelper.unaryMinus(actual));
-        
-        assertEquals((short)-1, InvokerHelper.unaryMinus((short)1));
-        assertEquals((byte)-1, InvokerHelper.unaryMinus((byte)1));
+
+        def negativeShortOne = InvokerHelper.unaryMinus((short) 1)
+        assert Short.class == negativeShortOne.class
+        assertEquals((short)-1, negativeShortOne);
+
+        def negativeByteOne = InvokerHelper.unaryMinus((byte) 1)
+        assert Byte.class == negativeByteOne.class
+        assertEquals((byte)-1, negativeByteOne);
     }
 
     public void testUnaryPlus() {


[groovy] 01/02: Trivial refactoring: make constants final

Posted by su...@apache.org.
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 356c3283a31b8cdbe3c5222e39e12b71e149a986
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Apr 18 22:44:22 2020 +0800

    Trivial refactoring: make constants final
    
    (cherry picked from commit f3028b394fc9fc35fe239a0bfcdc59cf23f800fc)
---
 src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java b/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
index ef55fb4..64aedd0 100644
--- a/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
+++ b/src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java
@@ -801,8 +801,8 @@ public class InvokerHelper {
         return argBuf.toString();
     }
 
-    private static Set<String> DEFAULT_IMPORT_PKGS = new HashSet<String>();
-    private static Set<String> DEFAULT_IMPORT_CLASSES = new HashSet<String>();
+    private static final Set<String> DEFAULT_IMPORT_PKGS = new HashSet<String>();
+    private static final Set<String> DEFAULT_IMPORT_CLASSES = new HashSet<String>();
     static {
         for (String pkgName : ResolveVisitor.DEFAULT_IMPORTS) {
             DEFAULT_IMPORT_PKGS.add(pkgName.substring(0, pkgName.length() - 1));