From fe4631c8d27dc20ead32f409667066e7f8bd5db8 Mon Sep 17 00:00:00 2001 From: sabi0 <2sabio@gmail.com> Date: Mon, 29 Jan 2024 09:16:40 +0100 Subject: [PATCH] Use short-circuit boolean expressions (#13042) --- .../test/org/apache/lucene/search/TestSearchWithThreads.java | 2 +- .../src/test/org/apache/lucene/util/TestWeakIdentityMap.java | 2 +- .../test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lucene/core/src/test/org/apache/lucene/search/TestSearchWithThreads.java b/lucene/core/src/test/org/apache/lucene/search/TestSearchWithThreads.java index d4bd95fca7a..24e069bd60d 100644 --- a/lucene/core/src/test/org/apache/lucene/search/TestSearchWithThreads.java +++ b/lucene/core/src/test/org/apache/lucene/search/TestSearchWithThreads.java @@ -69,7 +69,7 @@ public class TestSearchWithThreads extends LuceneTestCase { try { long totHits = 0; long totSearch = 0; - for (; totSearch < numSearches & !failed.get(); totSearch++) { + for (; totSearch < numSearches && !failed.get(); totSearch++) { totHits += s.search(new TermQuery(new Term("body", "aaa")), collectorManager); totHits += s.search(new TermQuery(new Term("body", "bbb")), collectorManager); } diff --git a/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java b/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java index 822f32a6a28..42a212f1f46 100644 --- a/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java +++ b/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java @@ -97,7 +97,7 @@ public class TestWeakIdentityMap extends LuceneTestCase { for (Iterator it = map.keyIterator(); it.hasNext(); ) { assertTrue(it.hasNext()); // try again, should return same result! final String k = it.next(); - assertTrue(k == key1 || k == key2 | k == key3); + assertTrue(k == key1 || k == key2 || k == key3); keysAssigned += (k == key1) ? 1 : ((k == key2) ? 2 : 4); c++; } diff --git a/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java b/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java index 89400fc6f72..0d7227f618d 100644 --- a/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java +++ b/lucene/core/src/test/org/apache/lucene/util/automaton/TestUTF32ToUTF8.java @@ -107,7 +107,7 @@ public class TestUTF32ToUTF8 extends LuceneTestCase { code = x; } if ((code >= UnicodeUtil.UNI_SUR_HIGH_START && code <= UnicodeUtil.UNI_SUR_HIGH_END) - | (code >= UnicodeUtil.UNI_SUR_LOW_START && code <= UnicodeUtil.UNI_SUR_LOW_END)) { + || (code >= UnicodeUtil.UNI_SUR_LOW_START && code <= UnicodeUtil.UNI_SUR_LOW_END)) { iter--; continue; }