groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [2/3] groovy git commit: Unnecessary zero length array usage
Date Mon, 02 Apr 2018 23:58:55 GMT
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/c0b5ea27
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/c0b5ea27
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/c0b5ea27

Branch: refs/heads/master
Commit: c0b5ea27efa2a82217197104fda1ba98271d344e
Parents: 75e1e87
Author: sunlan <sunlan@apache.org>
Authored: Tue Apr 3 07:50:33 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Tue Apr 3 07:58:46 2018 +0800

----------------------------------------------------------------------
 src/main/java/org/codehaus/groovy/reflection/CachedClass.java | 2 +-
 src/main/java/org/codehaus/groovy/tools/DgmConverter.java     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/c0b5ea27/src/main/java/org/codehaus/groovy/reflection/CachedClass.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/reflection/CachedClass.java b/src/main/java/org/codehaus/groovy/reflection/CachedClass.java
index c5f9c11..80bc040 100644
--- a/src/main/java/org/codehaus/groovy/reflection/CachedClass.java
+++ b/src/main/java/org/codehaus/groovy/reflection/CachedClass.java
@@ -151,7 +151,7 @@ public class CachedClass {
                 else
                   methods.add(cachedMethod);
             }
-            CachedMethod [] resMethods = methods.toArray(new CachedMethod[0]);
+            CachedMethod [] resMethods = methods.toArray(CachedMethod.EMPTY_ARRAY);
             Arrays.sort(resMethods);
 
             final CachedClass superClass = getCachedSuperClass();

http://git-wip-us.apache.org/repos/asf/groovy/blob/c0b5ea27/src/main/java/org/codehaus/groovy/tools/DgmConverter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/tools/DgmConverter.java b/src/main/java/org/codehaus/groovy/tools/DgmConverter.java
index 98d5cf9..b8adfd3 100644
--- a/src/main/java/org/codehaus/groovy/tools/DgmConverter.java
+++ b/src/main/java/org/codehaus/groovy/tools/DgmConverter.java
@@ -50,7 +50,7 @@ public class DgmConverter implements Opcodes {
         for (Class aClass : DefaultGroovyMethods.DGM_LIKE_CLASSES) {
             Collections.addAll(cachedMethodsList, ReflectionCache.getCachedClass(aClass).getMethods());
         }
-        final CachedMethod[] cachedMethods = cachedMethodsList.toArray(new CachedMethod[0]);
+        final CachedMethod[] cachedMethods = cachedMethodsList.toArray(CachedMethod.EMPTY_ARRAY);
 
         List<GeneratedMetaMethod.DgmMethodRecord> records = new ArrayList<GeneratedMetaMethod.DgmMethodRecord>();
 


Mime
View raw message