Thibault Kruse created GROOVY-7583:
--------------------------------------

             Summary: Unnecessary Instantiation on 
DefaultGroovyMethods.numberAwareCompareTo
                 Key: GROOVY-7583
                 URL: https://issues.apache.org/jira/browse/GROOVY-7583
             Project: Groovy
          Issue Type: Improvement
            Reporter: Thibault Kruse


in numberAwareCompareTo() 
{code}
        NumberAwareComparator<Comparable> numberAwareComparator = new 
NumberAwareComparator<Comparable>();
        return numberAwareComparator.compare(self, other);
{code}

The code inside NumberAwareComparator.compare can be static, so there is no 
need to create a new Instance of the Comparator every numberAwareCompareTo is 
called. I suggest extracting the logic into a public static method, and to use 
that, or anything similar.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to