Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-16427: Evaluate and fix errorprone rules - ObjectsHashCodePrimitive

Kevin Risden0106bfadbfb1
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;
}
}