Skip to content

Apache Lucene open-source search software

fix bad shift amounts and enable check (#11979)

Robert Muir4e93f29318e5
diff --git a/gradle/validation/error-prone.gradle b/gradle/validation/error-prone.gradle
index 44971d7409b..69a38574c4d 100644
--- a/gradle/validation/error-prone.gradle
+++ b/gradle/validation/error-prone.gradle
@@ -88,7 +88,7 @@ allprojects { prj ->
'-Xep:AutoValueBuilderDefaultsInConstructor:ERROR',
'-Xep:AutoValueConstructorOrderChecker:ERROR',
'-Xep:BadAnnotationImplementation:ERROR',
- // '-Xep:BadShiftAmount:OFF',
+ '-Xep:BadShiftAmount:ERROR',
'-Xep:BanJNDI:ERROR',
'-Xep:BoxedPrimitiveEquality:ERROR',
'-Xep:BundleDeserializationCast:ERROR',
diff --git a/lucene/core/src/test/org/apache/lucene/util/compress/LZ4TestCase.java b/lucene/core/src/test/org/apache/lucene/util/compress/LZ4TestCase.java
index 8d8dfaeb978..ddb556822d4 100644
--- a/lucene/core/src/test/org/apache/lucene/util/compress/LZ4TestCase.java
+++ b/lucene/core/src/test/org/apache/lucene/util/compress/LZ4TestCase.java
@@ -243,7 +243,7 @@ public abstract class LZ4TestCase extends LuceneTestCase {
}
public void testIncompressibleRandom() throws IOException {
- byte[] b = new byte[TestUtil.nextInt(random(), 1, 1 << 32)];
+ byte[] b = new byte[TestUtil.nextInt(random(), 1, 1 << 18)];
random().nextBytes(b);
doTest(b, newHashTable());
doTestWithDictionary(b, newHashTable());
diff --git a/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java b/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
index 1567d2df398..7700d96e3b5 100644
--- a/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
+++ b/lucene/join/src/test/org/apache/lucene/search/join/TestJoinUtil.java
@@ -1931,7 +1931,7 @@ public class TestJoinUtil extends LuceneTestCase {
document.add(new IntPoint(fieldName + "INT", linkInt));
document.add(new FloatPoint(fieldName + "FLOAT", linkInt));
- final long linkLong = linkInt << 32 | linkInt;
+ final long linkLong = (long) linkInt << 32 | linkInt;
document.add(new LongPoint(fieldName + "LONG", linkLong));
document.add(new DoublePoint(fieldName + "DOUBLE", linkLong));