groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject incubator-groovy git commit: GROOVY-7583: Unnecessary Instantiation on DefaultGroovyMethods.numberAwareCompareTo
Date Sun, 01 Nov 2015 09:41:28 GMT
Repository: incubator-groovy
Updated Branches:
  refs/heads/master 5c54dcfdf -> 94bcd4a45


GROOVY-7583: Unnecessary Instantiation on DefaultGroovyMethods.numberAwareCompareTo


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

Branch: refs/heads/master
Commit: 94bcd4a452d895cd2765f41d6220d8668b5e9023
Parents: 5c54dcf
Author: pascalschumacher <pascalschumacher@gmx.net>
Authored: Sun Nov 1 10:40:49 2015 +0100
Committer: pascalschumacher <pascalschumacher@gmx.net>
Committed: Sun Nov 1 10:40:49 2015 +0100

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


http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/94bcd4a4/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index ad1974d..e1fe2c1 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -170,6 +170,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport
{
 //            NioGroovyMethods.class
     };
     private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
+    private static final NumberAwareComparator<Comparable> COMPARABLE_NUMBER_AWARE_COMPARATOR
= new NumberAwareComparator<Comparable>();
 
     /**
      * Identity check. Since == is overridden in Groovy with the meaning of equality
@@ -1115,8 +1116,7 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport
{
      * @since 1.6.0
      */
     public static int numberAwareCompareTo(Comparable self, Comparable other) {
-        NumberAwareComparator<Comparable> numberAwareComparator = new NumberAwareComparator<Comparable>();
-        return numberAwareComparator.compare(self, other);
+        return COMPARABLE_NUMBER_AWARE_COMPARATOR.compare(self, other);
     }
 
     /**


Mime
View raw message