[ 
https://issues.apache.org/jira/browse/GROOVY-7583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pascal Schumacher updated GROOVY-7583:
--------------------------------------
    Priority: Minor  (was: Major)

> Unnecessary Instantiation on DefaultGroovyMethods.numberAwareCompareTo
> ----------------------------------------------------------------------
>
>                 Key: GROOVY-7583
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7583
>             Project: Groovy
>          Issue Type: Improvement
>    Affects Versions: 2.4.5
>            Reporter: Thibault Kruse
>            Priority: Minor
>
> 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