groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Trivial refactoring: use Integer.compare(int, int) instead
Date Fri, 29 Dec 2017 16:31:41 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X b945c43ee -> e04faf395


Trivial refactoring: use Integer.compare(int, int) instead

(cherry picked from commit 7050ae4)


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

Branch: refs/heads/GROOVY_2_6_X
Commit: e04faf395e4275f5d9a96636e1579068f9aaa6f9
Parents: b945c43
Author: sunlan <sunlan@apache.org>
Authored: Fri Dec 29 20:28:20 2017 +0800
Committer: Daniel Sun <realbluesun@hotmail.com>
Committed: Sat Dec 30 00:30:06 2017 +0800

----------------------------------------------------------------------
 .../org/codehaus/groovy/transform/SortableASTTransformation.java   | 2 +-
 .../org/codehaus/groovy/transform/ToStringASTTransformation.java   | 2 +-
 .../groovy/transform/TupleConstructorASTTransformation.java        | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e04faf39/src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java b/src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java
index 523cc97..0485e6d 100644
--- a/src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java
+++ b/src/main/java/org/codehaus/groovy/transform/SortableASTTransformation.java
@@ -226,7 +226,7 @@ public class SortableASTTransformation extends AbstractASTTransformation
{
         if (includes != null) {
             Comparator<PropertyNode> includeComparator = new Comparator<PropertyNode>()
{
                 public int compare(PropertyNode o1, PropertyNode o2) {
-                    return Integer.valueOf(includes.indexOf(o1.getName())).compareTo(includes.indexOf(o2.getName()));
+                    return Integer.compare(includes.indexOf(o1.getName()), includes.indexOf(o2.getName()));
                 }
             };
             Collections.sort(properties, includeComparator);

http://git-wip-us.apache.org/repos/asf/groovy/blob/e04faf39/src/main/java/org/codehaus/groovy/transform/ToStringASTTransformation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/transform/ToStringASTTransformation.java b/src/main/java/org/codehaus/groovy/transform/ToStringASTTransformation.java
index 559e8e0..36f376f 100644
--- a/src/main/java/org/codehaus/groovy/transform/ToStringASTTransformation.java
+++ b/src/main/java/org/codehaus/groovy/transform/ToStringASTTransformation.java
@@ -212,7 +212,7 @@ public class ToStringASTTransformation extends AbstractASTTransformation
{
         if (includes != null) {
             Comparator<ToStringElement> includeComparator = new Comparator<ToStringElement>()
{
                 public int compare(ToStringElement tse1, ToStringElement tse2) {
-                    return Integer.valueOf(includes.indexOf(tse1.name)).compareTo(includes.indexOf(tse2.name));
+                    return Integer.compare(includes.indexOf(tse1.name), includes.indexOf(tse2.name));
                 }
             };
             Collections.sort(elements, includeComparator);

http://git-wip-us.apache.org/repos/asf/groovy/blob/e04faf39/src/main/java/org/codehaus/groovy/transform/TupleConstructorASTTransformation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/codehaus/groovy/transform/TupleConstructorASTTransformation.java
b/src/main/java/org/codehaus/groovy/transform/TupleConstructorASTTransformation.java
index a32a2ad..20577cb 100644
--- a/src/main/java/org/codehaus/groovy/transform/TupleConstructorASTTransformation.java
+++ b/src/main/java/org/codehaus/groovy/transform/TupleConstructorASTTransformation.java
@@ -236,7 +236,7 @@ public class TupleConstructorASTTransformation extends AbstractASTTransformation
         if (includes != null) {
             Comparator<Parameter> includeComparator = new Comparator<Parameter>()
{
                 public int compare(Parameter p1, Parameter p2) {
-                    return Integer.valueOf(includes.indexOf(p1.getName())).compareTo(includes.indexOf(p2.getName()));
+                    return Integer.compare(includes.indexOf(p1.getName()), includes.indexOf(p2.getName()));
                 }
             };
             Collections.sort(params, includeComparator);


Mime
View raw message