Apache Lucene open-source search software
LUCENE-8581: Unreference LatLonPoint.BYTES from LatLonShape & Rectangle2D.
David Smiley70dd3ee06a49
diff --git a/lucene/sandbox/src/java/org/apache/lucene/document/LatLonShape.java b/lucene/sandbox/src/java/org/apache/lucene/document/LatLonShape.javaindex 30b481929d2..ee41ffa51fc 100644--- a/lucene/sandbox/src/java/org/apache/lucene/document/LatLonShape.java+++ b/lucene/sandbox/src/java/org/apache/lucene/document/LatLonShape.java@@ -55,7 +55,7 @@ import static org.apache.lucene.geo.GeoEncodingUtils.encodeLongitude;* @lucene.experimental*/public class LatLonShape {- public static final int BYTES = LatLonPoint.BYTES;+ static final int BYTES = Integer.BYTES;protected static final FieldType TYPE = new FieldType();static {diff --git a/lucene/sandbox/src/java/org/apache/lucene/geo/Rectangle2D.java b/lucene/sandbox/src/java/org/apache/lucene/geo/Rectangle2D.javaindex 7f7def52d16..430f77b675a 100644--- a/lucene/sandbox/src/java/org/apache/lucene/geo/Rectangle2D.java+++ b/lucene/sandbox/src/java/org/apache/lucene/geo/Rectangle2D.java@@ -19,12 +19,11 @@ package org.apache.lucene.geo;import java.util.Arrays;-import org.apache.lucene.document.LatLonShape;import org.apache.lucene.index.PointValues;import org.apache.lucene.util.FutureArrays;import org.apache.lucene.util.NumericUtils;-import static org.apache.lucene.document.LatLonShape.BYTES;+import static java.lang.Integer.BYTES;import static org.apache.lucene.geo.GeoEncodingUtils.MAX_LON_ENCODED;import static org.apache.lucene.geo.GeoEncodingUtils.MIN_LON_ENCODED;import static org.apache.lucene.geo.GeoEncodingUtils.decodeLatitude;@@ -184,7 +183,7 @@ public class Rectangle2D {*/private static void encode(final int minX, final int maxX, final int minY, final int maxY, byte[] b) {if (b == null) {- b = new byte[4 * LatLonShape.BYTES];+ b = new byte[4 * BYTES];}NumericUtils.intToSortableBytes(minY, b, 0);NumericUtils.intToSortableBytes(minX, b, BYTES);diff --git a/lucene/sandbox/src/test/org/apache/lucene/geo/TestRectangle2D.java b/lucene/sandbox/src/test/org/apache/lucene/geo/TestRectangle2D.javaindex 01a50e99e22..ef90c338420 100644--- a/lucene/sandbox/src/test/org/apache/lucene/geo/TestRectangle2D.java+++ b/lucene/sandbox/src/test/org/apache/lucene/geo/TestRectangle2D.java@@ -17,12 +17,11 @@package org.apache.lucene.geo;-import org.apache.lucene.document.LatLonShape;import org.apache.lucene.index.PointValues;import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.NumericUtils;-import static org.apache.lucene.document.LatLonShape.BYTES;+import static java.lang.Integer.BYTES;public class TestRectangle2D extends LuceneTestCase {@@ -82,13 +81,13 @@ public class TestRectangle2D extends LuceneTestCase {int tMinY = StrictMath.min(StrictMath.min(ay, by), cy);int tMaxY = StrictMath.max(StrictMath.max(ay, by), cy);- byte[] triangle = new byte[4 * LatLonShape.BYTES];+ byte[] triangle = new byte[4 * BYTES];NumericUtils.intToSortableBytes(tMinY, triangle, 0);NumericUtils.intToSortableBytes(tMinX, triangle, BYTES);NumericUtils.intToSortableBytes(tMaxY, triangle, 2 * BYTES);NumericUtils.intToSortableBytes(tMaxX, triangle, 3 * BYTES);- PointValues.Relation r = rectangle2D.relateRangeBBox(LatLonShape.BYTES, 0, triangle, 3 * LatLonShape.BYTES, 2 * LatLonShape.BYTES, triangle);+ PointValues.Relation r = rectangle2D.relateRangeBBox(BYTES, 0, triangle, 3 * BYTES, 2 * BYTES, triangle);if (r == PointValues.Relation.CELL_OUTSIDE_QUERY) {assertFalse(rectangle2D.intersectsTriangle(ax, ay, bx, by , cx, cy));assertFalse(rectangle2D.containsTriangle(ax, ay, bx, by , cx, cy));