Repository: groovy
Updated Branches:
  refs/heads/master daadd6eb4 -> fc01573ff


Trivial refactoring: avoid redundant array creation


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

Branch: refs/heads/master
Commit: fc01573ff97be0f25dec1f975f6308fa82c97287
Parents: daadd6e
Author: danielsun1106 <realblue...@hotmail.com>
Authored: Tue Feb 20 03:26:21 2018 +0800
Committer: danielsun1106 <realblue...@hotmail.com>
Committed: Tue Feb 20 03:26:21 2018 +0800

----------------------------------------------------------------------
 src/main/groovy/groovy/util/FactoryBuilderSupport.java | 10 +++++-----
 src/main/groovy/groovy/util/Node.java                  |  2 +-
 src/main/groovy/groovy/util/ObjectGraphBuilder.java    |  4 ++--
 src/main/groovy/groovy/util/ObservableMap.java         |  4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/fc01573f/src/main/groovy/groovy/util/FactoryBuilderSupport.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/util/FactoryBuilderSupport.java 
b/src/main/groovy/groovy/util/FactoryBuilderSupport.java
index 8dbcff0..1074e53 100644
--- a/src/main/groovy/groovy/util/FactoryBuilderSupport.java
+++ b/src/main/groovy/groovy/util/FactoryBuilderSupport.java
@@ -791,7 +791,7 @@ public abstract class FactoryBuilderSupport extends Binding 
{
                 return dispatchNodeCall(name, args);
             } catch(MissingMethodException mme) {
                 if(mme.getMethod().equals(methodName) && methodMissingDelegate 
!= null) {
-                    return methodMissingDelegate.call(new Object[]{methodName, 
args});
+                    return methodMissingDelegate.call(methodName, args);
                 }
                 throw mme;
             }
@@ -982,7 +982,7 @@ public abstract class FactoryBuilderSupport extends Binding 
{
                 builder = (FactoryBuilderSupport) attrDelegate.getDelegate();
             }
 
-            attrDelegate.call(new Object[]{builder, node, attributes});
+            attrDelegate.call(builder, node, attributes);
         }
 
         if 
(getProxyBuilder().getCurrentFactory().onHandleNodeAttributes(getProxyBuilder().getChildBuilder(),
 node, attributes)) {
@@ -1031,7 +1031,7 @@ public abstract class FactoryBuilderSupport extends 
Binding {
      */
     protected void postInstantiate(Object name, Map attributes, Object node) {
         for (Closure postInstantiateDelegate : 
getProxyBuilder().getPostInstantiateDelegates()) {
-            (postInstantiateDelegate).call(new Object[]{this, attributes, 
node});
+            (postInstantiateDelegate).call(this, attributes, node);
         }
     }
 
@@ -1048,7 +1048,7 @@ public abstract class FactoryBuilderSupport extends 
Binding {
      */
     protected Object postNodeCompletion(Object parent, Object node) {
         for (Closure postNodeCompletionDelegate : 
getProxyBuilder().getPostNodeCompletionDelegates()) {
-            (postNodeCompletionDelegate).call(new Object[]{this, parent, 
node});
+            (postNodeCompletionDelegate).call(this, parent, node);
         }
 
         return node;
@@ -1065,7 +1065,7 @@ public abstract class FactoryBuilderSupport extends 
Binding {
      */
     protected void preInstantiate(Object name, Map attributes, Object value) {
         for (Closure preInstantiateDelegate : 
getProxyBuilder().getPreInstantiateDelegates()) {
-            (preInstantiateDelegate).call(new Object[]{this, attributes, 
value});
+            (preInstantiateDelegate).call(this, attributes, value);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/fc01573f/src/main/groovy/groovy/util/Node.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/util/Node.java 
b/src/main/groovy/groovy/util/Node.java
index e40b14a..76fdcca 100644
--- a/src/main/groovy/groovy/util/Node.java
+++ b/src/main/groovy/groovy/util/Node.java
@@ -615,7 +615,7 @@ public class Node implements Serializable, Cloneable {
 
     private static <T> T callClosureForNode(Closure<T> closure, Object node, 
int level) {
         if (closure.getMaximumNumberOfParameters() == 2) {
-            return closure.call(new Object[]{node, level});
+            return closure.call(node, level);
         }
         return closure.call(node);
     }

http://git-wip-us.apache.org/repos/asf/groovy/blob/fc01573f/src/main/groovy/groovy/util/ObjectGraphBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/util/ObjectGraphBuilder.java 
b/src/main/groovy/groovy/util/ObjectGraphBuilder.java
index 7ba0089..1004369 100644
--- a/src/main/groovy/groovy/util/ObjectGraphBuilder.java
+++ b/src/main/groovy/groovy/util/ObjectGraphBuilder.java
@@ -158,7 +158,7 @@ public class ObjectGraphBuilder extends 
FactoryBuilderSupport {
                                      String propertyName) {
                     Closure cls = (Closure) childPropertySetter;
                     cls.setDelegate(self);
-                    cls.call(new Object[]{parent, child, parentName, 
propertyName});
+                    cls.call(parent, child, parentName, propertyName);
                 }
             };
         } else {
@@ -271,7 +271,7 @@ public class ObjectGraphBuilder extends 
FactoryBuilderSupport {
                         throws InstantiationException, IllegalAccessException {
                     Closure cls = (Closure) newInstanceResolver;
                     cls.setDelegate(self);
-                    return cls.call(new Object[]{klass, attributes});
+                    return cls.call(klass, attributes);
                 }
             };
         } else {

http://git-wip-us.apache.org/repos/asf/groovy/blob/fc01573f/src/main/groovy/groovy/util/ObservableMap.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/util/ObservableMap.java 
b/src/main/groovy/groovy/util/ObservableMap.java
index 94b9816..a71165f 100644
--- a/src/main/groovy/groovy/util/ObservableMap.java
+++ b/src/main/groovy/groovy/util/ObservableMap.java
@@ -187,7 +187,7 @@ public class ObservableMap implements Map {
             oldValue = delegate.put(key, value);
             Object result = null;
             if (test.getMaximumNumberOfParameters() == 2) {
-                result = test.call(new Object[]{key, value});
+                result = test.call(key, value);
             } else {
                 result = test.call(value);
             }
@@ -227,7 +227,7 @@ public class ObservableMap implements Map {
                     oldValue = delegate.put(key, newValue);
                     Object result = null;
                     if (test.getMaximumNumberOfParameters() == 2) {
-                        result = test.call(new Object[]{key, newValue});
+                        result = test.call(key, newValue);
                     } else {
                         result = test.call(newValue);
                     }

Reply via email to