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 2016/07/28 12:42:07 UTC

[6/6] groovy git commit: InvokerHelper: Refactor: Remove redundant if cases, format method has them (closes #96)

InvokerHelper: Refactor: Remove redundant if cases, format method has them (closes #96)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/c9bd001c
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/c9bd001c
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/c9bd001c

Branch: refs/heads/master
Commit: c9bd001ccefa990dcee0f78fb3d8a64356abf1e5
Parents: 3b19871
Author: Thibault Kruse <th...@gmx.de>
Authored: Wed Sep 2 00:17:43 2015 +0200
Committer: paulk <pa...@asert.com.au>
Committed: Thu Jul 28 22:40:29 2016 +1000

----------------------------------------------------------------------
 src/main/org/codehaus/groovy/runtime/InvokerHelper.java | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/c9bd001c/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/InvokerHelper.java b/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
index 7859934..37cdf29 100644
--- a/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
+++ b/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
@@ -124,15 +124,11 @@ public class InvokerHelper {
     }
 
     public static String toString(Object arguments) {
-        if (arguments instanceof Object[]) {
-            return toArrayString((Object[]) arguments);
-        }
-        if (arguments instanceof Collection) {
+        if (arguments instanceof Range) {
+            // for historic reasons, toString() formats Ranges by printing
+            // them as a list, whereas format prints them in .. notation
             return toListString((Collection) arguments);
         }
-        if (arguments instanceof Map) {
-            return toMapString((Map) arguments);
-        }
         return format(arguments, false);
     }