groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Unnecessary zero length array usage
Date Tue, 03 Apr 2018 10:45:02 GMT
Repository: groovy
Updated Branches:
  refs/heads/master fd7aa8115 -> 249d5731e


Unnecessary zero length array usage

(cherry picked from commit 7d9b504)


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

Branch: refs/heads/master
Commit: 249d5731e3e7152208b3a921c959fde604fc69cd
Parents: fd7aa81
Author: sunlan <sunlan@apache.org>
Authored: Tue Apr 3 18:05:28 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Tue Apr 3 18:44:56 2018 +0800

----------------------------------------------------------------------
 src/main/groovy/groovy/lang/MetaClassImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/249d5731/src/main/groovy/groovy/lang/MetaClassImpl.java
----------------------------------------------------------------------
diff --git a/src/main/groovy/groovy/lang/MetaClassImpl.java b/src/main/groovy/groovy/lang/MetaClassImpl.java
index 8409bbf..ab8b655 100644
--- a/src/main/groovy/groovy/lang/MetaClassImpl.java
+++ b/src/main/groovy/groovy/lang/MetaClassImpl.java
@@ -137,7 +137,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
             return o1.getName().compareTo(o2.getName());
         }
     };
-    private static final MetaMethod[] EMPTY = new MetaMethod[0];
+    private static final MetaMethod[] EMPTY = MetaMethod.EMPTY_ARRAY;
     private static final MetaMethod AMBIGUOUS_LISTENER_METHOD = new DummyMetaMethod();
 
     protected final Class theClass;
@@ -189,7 +189,7 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass {
             List<MetaMethod> arr = new ArrayList<MetaMethod>();
             arr.addAll(Arrays.asList(metaMethods));
             arr.addAll(Arrays.asList(add));
-            myNewMetaMethods = arr.toArray(new MetaMethod[0]);
+            myNewMetaMethods = arr.toArray(MetaMethod.EMPTY_ARRAY);
             additionalMetaMethods = metaMethods;
         }
         else {


Mime
View raw message