You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2022/10/28 15:21:50 UTC

[solr] 09/12: SOLR-16427: Evaluate and fix errorprone rules - ObjectsHashCodePrimitive

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 90fb08bb1419de02fad276a1e3bc407e20038768
Author: Kevin Risden <kr...@apache.org>
AuthorDate: Tue Oct 25 16:56:39 2022 -0400

    SOLR-16427: Evaluate and fix errorprone rules - ObjectsHashCodePrimitive
---
 gradle/validation/error-prone.gradle                                | 1 -
 .../src/java/org/apache/solr/legacy/LegacyNumericRangeQuery.java    | 6 +++---
 .../java/org/apache/solr/search/join/CrossCollectionJoinQuery.java  | 2 +-
 solr/core/src/java/org/apache/solr/search/join/HashRangeQuery.java  | 4 ++--
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/gradle/validation/error-prone.gradle b/gradle/validation/error-prone.gradle
index 175b90f792d..ea0f5b6534e 100644
--- a/gradle/validation/error-prone.gradle
+++ b/gradle/validation/error-prone.gradle
@@ -95,7 +95,6 @@ allprojects { prj ->
             '-Xep:NonAtomicVolatileUpdate:OFF',
             '-Xep:NonCanonicalType:OFF',
             '-Xep:ObjectToString:OFF',
-            '-Xep:ObjectsHashCodePrimitive:OFF',
             '-Xep:OperatorPrecedence:OFF',
             '-Xep:ReturnValueIgnored:OFF',
             '-Xep:SameNameButDifferent:OFF',
diff --git a/solr/core/src/java/org/apache/solr/legacy/LegacyNumericRangeQuery.java b/solr/core/src/java/org/apache/solr/legacy/LegacyNumericRangeQuery.java
index 66c5abe05d6..617dcfa57b4 100644
--- a/solr/core/src/java/org/apache/solr/legacy/LegacyNumericRangeQuery.java
+++ b/solr/core/src/java/org/apache/solr/legacy/LegacyNumericRangeQuery.java
@@ -434,13 +434,13 @@ public final class LegacyNumericRangeQuery<T extends Number> extends MultiTermQu
   }
 
   @Override
-  public final int hashCode() {
+  public int hashCode() {
     int hash = super.hashCode();
     hash = 31 * hash + precisionStep;
     hash = 31 * hash + Objects.hashCode(min);
     hash = 31 * hash + Objects.hashCode(max);
-    hash = 31 * hash + Objects.hashCode(minInclusive);
-    hash = 31 * hash + Objects.hashCode(maxInclusive);
+    hash = 31 * hash + Boolean.hashCode(minInclusive);
+    hash = 31 * hash + Boolean.hashCode(maxInclusive);
     return hash;
   }
 
diff --git a/solr/core/src/java/org/apache/solr/search/join/CrossCollectionJoinQuery.java b/solr/core/src/java/org/apache/solr/search/join/CrossCollectionJoinQuery.java
index c0fb74355df..b0b396cf6cf 100644
--- a/solr/core/src/java/org/apache/solr/search/join/CrossCollectionJoinQuery.java
+++ b/solr/core/src/java/org/apache/solr/search/join/CrossCollectionJoinQuery.java
@@ -362,7 +362,7 @@ public class CrossCollectionJoinQuery extends Query {
     result = prime * result + Objects.hashCode(collection);
     result = prime * result + Objects.hashCode(fromField);
     result = prime * result + Objects.hashCode(toField);
-    result = prime * result + Objects.hashCode(routedByJoinKey);
+    result = prime * result + Boolean.hashCode(routedByJoinKey);
     result = prime * result + Objects.hashCode(otherParamsString);
     // timestamp and ttl should not be included in hash code
     return result;
diff --git a/solr/core/src/java/org/apache/solr/search/join/HashRangeQuery.java b/solr/core/src/java/org/apache/solr/search/join/HashRangeQuery.java
index cd9d052d445..d0bdc326747 100644
--- a/solr/core/src/java/org/apache/solr/search/join/HashRangeQuery.java
+++ b/solr/core/src/java/org/apache/solr/search/join/HashRangeQuery.java
@@ -143,8 +143,8 @@ public class HashRangeQuery extends Query {
     final int prime = 31;
     int result = classHash();
     result = prime * result + Objects.hashCode(field);
-    result = prime * result + Objects.hashCode(lower);
-    result = prime * result + Objects.hashCode(upper);
+    result = prime * result + Integer.hashCode(lower);
+    result = prime * result + Integer.hashCode(upper);
     return result;
   }
 }