Trivial refactoring: avoid zero length GenericsType array creation

(cherry picked from commit 45448c5)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: c52400df4a990e324cab6bb1f4f58ac6e597b506
Parents: c3f34f6
Author: danielsun1106 <realblue...@hotmail.com>
Authored: Tue Feb 20 03:15:32 2018 +0800
Committer: danielsun1106 <realblue...@hotmail.com>
Committed: Tue Feb 20 03:42:25 2018 +0800

----------------------------------------------------------------------
 src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/c52400df/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java 
b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
index 642f90c..126ef42 100644
--- a/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
+++ b/src/main/java/org/codehaus/groovy/ast/tools/GenericsUtils.java
@@ -57,7 +57,7 @@ import static 
org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport.implem
  * @author Paul King
  */
 public class GenericsUtils {
-    public static final GenericsType[] EMPTY_GENERICS_ARRAY = new 
GenericsType[0];
+    public static final GenericsType[] EMPTY_GENERICS_ARRAY = 
GenericsType.EMPTY_ARRAY;
     public static final String JAVA_LANG_OBJECT = "java.lang.Object";
 
     /**
@@ -274,7 +274,7 @@ public class GenericsUtils {
         if (type.isArray()) {
             return makeClassSafeWithGenerics(type.getComponentType(), 
genericTypes).makeArray();
         }
-        GenericsType[] gtypes = new GenericsType[0];
+        GenericsType[] gtypes = GenericsType.EMPTY_ARRAY;
         if (genericTypes != null) {
             gtypes = new GenericsType[genericTypes.length];
             System.arraycopy(genericTypes, 0, gtypes, 0, gtypes.length);

Reply via email to