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:05:34 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 5def1d1ca -> 7d9b50441


Unnecessary zero length array usage


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

Branch: refs/heads/GROOVY_2_6_X
Commit: 7d9b504418e414e02b4904630c1b4ea07e8c3cc4
Parents: 5def1d1
Author: sunlan <sunlan@apache.org>
Authored: Tue Apr 3 18:05:28 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Tue Apr 3 18:05:28 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/7d9b5044/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