Skip to content

Apache Lucene open-source search software

LUCENE-9290 Fix TestXYPoint#testEqualsAndHashCode

Ignacio Vera8cb50a52bc07
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 1facd2026be..d953f9afa06 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -99,6 +99,9 @@ Bug fixes
* LUCENE-9117: RamUsageEstimator hangs with AOT compilation. Removed any attempt to
estimate Long.valueOf cache size. (Cleber Muramoto, Dawid Weiss)
+* LUCENE-9290: Don't assume that different XYPoint have different hash code
+ (Ignacio Vera via Mike Drob)
+
Other
* LUCENE-8768: Fix Javadocs build in Java 11. (Namgyu Kim)
diff --git a/lucene/core/src/test/org/apache/lucene/geo/TestXYPoint.java b/lucene/core/src/test/org/apache/lucene/geo/TestXYPoint.java
index 7fb48a8cc60..519d720da8f 100644
--- a/lucene/core/src/test/org/apache/lucene/geo/TestXYPoint.java
+++ b/lucene/core/src/test/org/apache/lucene/geo/TestXYPoint.java
@@ -68,7 +68,7 @@ public class TestXYPoint extends LuceneTestCase {
XYPoint otherPoint = new XYPoint(ShapeTestUtil.nextFloat(random()), ShapeTestUtil.nextFloat(random()));
if (point.getX() != otherPoint.getX() || point.getY() != otherPoint.getY()) {
assertNotEquals(point, otherPoint);
- assertNotEquals(point.hashCode(), otherPoint.hashCode());
+ // it is possible to have hashcode collisions
} else {
assertEquals(point, otherPoint);
assertEquals(point.hashCode(), otherPoint.hashCode());