lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [07/52] [abbrv] lucene-solr:jira/solr-9959: LUCENE-7751: Avoid boxing primitives only to call compareTo.
Date Mon, 03 Apr 2017 18:45:13 GMT
LUCENE-7751: Avoid boxing primitives only to call compareTo.


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

Branch: refs/heads/jira/solr-9959
Commit: c189139e5222d2a8b6fba6bfc5c1194d68b46a77
Parents: 53064e4
Author: Adrien Grand <jpountz@gmail.com>
Authored: Tue Mar 28 15:21:35 2017 +0200
Committer: Adrien Grand <jpountz@gmail.com>
Committed: Tue Mar 28 15:35:04 2017 +0200

----------------------------------------------------------------------
 lucene/CHANGES.txt                                              | 3 +++
 lucene/core/src/java/org/apache/lucene/util/VirtualMethod.java  | 2 +-
 .../src/java/org/apache/solr/spelling/SpellCheckCollation.java  | 2 +-
 .../solr/handler/component/DistributedFacetPivotSmallTest.java  | 5 ++---
 solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java | 4 ++--
 5 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c189139e/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index e6da586..a8f24c7 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -87,6 +87,9 @@ Other
 * LUCENE-7754: Inner classes should be static whenever possible.
   (Daniel Jelinski via Adrien Grand)
 
+* LUCENE-7751: Avoid boxing primitives only to call compareTo.
+  (Daniel Jelinski via Adrien Grand)
+
 ======================= Lucene 6.5.0 =======================
 
 API Changes

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c189139e/lucene/core/src/java/org/apache/lucene/util/VirtualMethod.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/util/VirtualMethod.java b/lucene/core/src/java/org/apache/lucene/util/VirtualMethod.java
index f21c16b..ea56862 100644
--- a/lucene/core/src/java/org/apache/lucene/util/VirtualMethod.java
+++ b/lucene/core/src/java/org/apache/lucene/util/VirtualMethod.java
@@ -143,7 +143,7 @@ public final class VirtualMethod<C> {
   public static <C> int compareImplementationDistance(final Class<? extends C>
clazz,
     final VirtualMethod<C> m1, final VirtualMethod<C> m2)
   {
-    return Integer.valueOf(m1.getImplementationDistance(clazz)).compareTo(m2.getImplementationDistance(clazz));
+    return Integer.compare(m1.getImplementationDistance(clazz), m2.getImplementationDistance(clazz));
   }
   
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c189139e/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollation.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollation.java b/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollation.java
index bef3ec6..7f3bd95 100644
--- a/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollation.java
+++ b/solr/core/src/java/org/apache/solr/spelling/SpellCheckCollation.java
@@ -26,7 +26,7 @@ public class SpellCheckCollation implements Comparable<SpellCheckCollation>
{
 
   @Override
   public int compareTo(SpellCheckCollation scc) {
-    int c = new Integer(internalRank).compareTo(scc.internalRank);
+    int c = Integer.compare(internalRank, scc.internalRank);
     if (c == 0) {
       return collationQuery.compareTo(scc.collationQuery);
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c189139e/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java
b/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java
index fc7af80..d293e69 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedFacetPivotSmallTest.java
@@ -1636,8 +1636,7 @@ public class DistributedFacetPivotSmallTest extends BaseDistributedSearchTestCas
     
     @Override
     public int compare(PivotField o1, PivotField o2) {
-      Integer compare = (Integer.valueOf(o2.getCount())).compareTo(Integer
-          .valueOf(o1.getCount()));
+      int compare = Integer.compare(o2.getCount(), o1.getCount());
       if (compare == 0) {
         compare = ((String) o2.getValue()).compareTo((String) o1.getValue());
       }
@@ -1650,7 +1649,7 @@ public class DistributedFacetPivotSmallTest extends BaseDistributedSearchTestCas
           }
         }
         if (compare == 0) {
-          compare = Integer.valueOf(o1.getFacetQuery().size()).compareTo(
+          compare = Integer.compare(o1.getFacetQuery().size(),
               o2.getFacetQuery().size());
         }
       }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c189139e/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java b/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java
index 6fffb3a..846c25e 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/DocRouter.java
@@ -134,8 +134,8 @@ public abstract class DocRouter {
 
     @Override
     public int compareTo(Range that) {
-      int mincomp = Integer.valueOf(this.min).compareTo(that.min);
-      return mincomp == 0 ? Integer.valueOf(this.max).compareTo(that.max) : mincomp;
+      int mincomp = Integer.compare(this.min, that.min);
+      return mincomp == 0 ? Integer.compare(this.max, that.max) : mincomp;
     }
   }
 


Mime
View raw message