Skip to content

Apache Lucene open-source search software

Replacing unused variable suppress warning with _ (Part 2/5) (#15105)

Ankit Jainba7f659b1d81
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SpatialFileQueryMaker.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SpatialFileQueryMaker.java
index ca3fa4b11b2..a57f3083445 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SpatialFileQueryMaker.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SpatialFileQueryMaker.java
@@ -82,9 +82,7 @@ public class SpatialFileQueryMaker extends AbstractQueryMaker {
i--; // skip
}
}
- } catch (
- @SuppressWarnings("unused")
- NoMoreDataException e) {
+ } catch (NoMoreDataException _) {
// all-done
} finally {
src.close();
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java
index 032019f1e4e..7251f5ce93d 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java
@@ -79,9 +79,7 @@ public class NewAnalyzerTask extends PerfTask {
String coreClassName = "org.apache.lucene.analysis.core." + analyzerName;
analyzer = createAnalyzer(coreClassName);
analyzerName = coreClassName;
- } catch (
- @SuppressWarnings("unused")
- ClassNotFoundException e) {
+ } catch (ClassNotFoundException _) {
// If not a core analyzer, try the base analysis package
analyzerName = "org.apache.lucene.analysis." + analyzerName;
analyzer = createAnalyzer(analyzerName);
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java
index 796232af208..d11eff827a4 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java
@@ -206,9 +206,7 @@ public class TaskSequence extends PerfTask {
countsByTime[slot] += inc;
}
if (anyExhaustibleTasks) updateExhausted(task);
- } catch (
- @SuppressWarnings("unused")
- NoMoreDataException e) {
+ } catch (NoMoreDataException _) {
exhausted = true;
}
}
@@ -275,9 +273,7 @@ public class TaskSequence extends PerfTask {
}
if (anyExhaustibleTasks) updateExhausted(task);
- } catch (
- @SuppressWarnings("unused")
- NoMoreDataException e) {
+ } catch (NoMoreDataException _) {
exhausted = true;
}
}
@@ -319,9 +315,7 @@ public class TaskSequence extends PerfTask {
updateExhausted(task);
}
count += n;
- } catch (
- @SuppressWarnings("unused")
- NoMoreDataException e) {
+ } catch (NoMoreDataException _) {
exhausted = true;
} catch (Exception e) {
throw new RuntimeException(e);
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java
index 29510203f16..de672ee9480 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java
@@ -308,9 +308,7 @@ public class Algorithm implements AutoCloseable {
for (String pkg : taskPackages) {
try {
return Class.forName(pkg + '.' + taskName + "Task");
- } catch (
- @SuppressWarnings("unused")
- ClassNotFoundException e) {
+ } catch (ClassNotFoundException _) {
// failed in this package, might succeed in the next one...
}
}
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/quality/QualityQuery.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/quality/QualityQuery.java
index 2dca0e43a6c..7036b0190d5 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/quality/QualityQuery.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/quality/QualityQuery.java
@@ -74,9 +74,7 @@ public class QualityQuery implements Comparable<QualityQuery> {
int n = Integer.parseInt(queryID);
int nOther = Integer.parseInt(other.queryID);
return n - nOther;
- } catch (
- @SuppressWarnings("unused")
- NumberFormatException e) {
+ } catch (NumberFormatException _) {
// fall back to string comparison
return queryID.compareTo(other.queryID);
}
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java
index 687037bd70a..9fcbefcbae3 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java
@@ -96,9 +96,7 @@ public class ExtractWikipedia {
doc.get(DocMaker.DATE_FIELD),
doc.get(DocMaker.BODY_FIELD));
}
- } catch (
- @SuppressWarnings("unused")
- NoMoreDataException e) {
+ } catch (NoMoreDataException _) {
// continue
}
long finish = System.currentTimeMillis();
diff --git a/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/TestTrecContentSource.java b/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/TestTrecContentSource.java
index 71aca1e1964..5b317b27f1b 100644
--- a/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/TestTrecContentSource.java
+++ b/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/TestTrecContentSource.java
@@ -424,9 +424,7 @@ public class TestTrecContentSource extends LuceneTestCase {
assertTrue("Should never get here!", false);
}
}
- } catch (
- @SuppressWarnings("unused")
- NoMoreDataException e) {
+ } catch (NoMoreDataException _) {
gotExpectedException = true;
}
assertTrue("Should have gotten NoMoreDataException!", gotExpectedException);
diff --git a/lucene/core/src/java/org/apache/lucene/analysis/TokenStream.java b/lucene/core/src/java/org/apache/lucene/analysis/TokenStream.java
index aaf7de926fa..e7360d2fb1e 100644
--- a/lucene/core/src/java/org/apache/lucene/analysis/TokenStream.java
+++ b/lucene/core/src/java/org/apache/lucene/analysis/TokenStream.java
@@ -111,9 +111,7 @@ public abstract class TokenStream extends AttributeSource implements Closeable {
|| Modifier.isFinal(clazz.getMethod("incrementToken").getModifiers())
: "TokenStream implementation classes or at least their incrementToken() implementation must be final";
return true;
- } catch (
- @SuppressWarnings("unused")
- NoSuchMethodException nsme) {
+ } catch (NoSuchMethodException _) {
return false;
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene103/blocktree/IntersectTermsEnum.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene103/blocktree/IntersectTermsEnum.java
index 647e2eb1665..bc364a5d1ed 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene103/blocktree/IntersectTermsEnum.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene103/blocktree/IntersectTermsEnum.java
@@ -364,9 +364,7 @@ final class IntersectTermsEnum extends BaseTermsEnum {
public BytesRef next() throws IOException {
try {
return _next();
- } catch (
- @SuppressWarnings("unused")
- NoMoreTermsException eoi) {
+ } catch (NoMoreTermsException _) {
// Provoke NPE if we are (illegally!) called again:
currentFrame = null;
return null;
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingStoredFieldsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingStoredFieldsWriter.java
index eb52978b04f..39009b1eb56 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingStoredFieldsWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingStoredFieldsWriter.java
@@ -497,9 +497,7 @@ public final class Lucene90CompressingStoredFieldsWriter extends StoredFieldsWri
boolean v = true;
try {
v = Boolean.parseBoolean(System.getProperty(BULK_MERGE_ENABLED_SYSPROP, "true"));
- } catch (
- @SuppressWarnings("unused")
- SecurityException ignored) {
+ } catch (SecurityException _) {
}
BULK_MERGE_ENABLED = v;
}
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsWriter.java
index e053e389a8d..1d6aa1141da 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsWriter.java
@@ -796,9 +796,7 @@ public final class Lucene90CompressingTermVectorsWriter extends TermVectorsWrite
boolean v = true;
try {
v = Boolean.parseBoolean(System.getProperty(BULK_MERGE_ENABLED_SYSPROP, "true"));
- } catch (
- @SuppressWarnings("unused")
- SecurityException ignored) {
+ } catch (SecurityException _) {
}
BULK_MERGE_ENABLED = v;
}
diff --git a/lucene/core/src/java/org/apache/lucene/document/SpatialQuery.java b/lucene/core/src/java/org/apache/lucene/document/SpatialQuery.java
index ce514b0ce55..91bdae91b5a 100644
--- a/lucene/core/src/java/org/apache/lucene/document/SpatialQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/document/SpatialQuery.java
@@ -793,9 +793,7 @@ abstract class SpatialQuery extends Query {
return rel;
}
});
- } catch (
- @SuppressWarnings("unused")
- CollectionTerminatedException e) {
+ } catch (CollectionTerminatedException _) {
return true;
}
return false;
diff --git a/lucene/core/src/java/org/apache/lucene/geo/SimpleGeoJSONPolygonParser.java b/lucene/core/src/java/org/apache/lucene/geo/SimpleGeoJSONPolygonParser.java
index 9f17cce9193..8789ed0bf92 100644
--- a/lucene/core/src/java/org/apache/lucene/geo/SimpleGeoJSONPolygonParser.java
+++ b/lucene/core/src/java/org/apache/lucene/geo/SimpleGeoJSONPolygonParser.java
@@ -342,9 +342,7 @@ class SimpleGeoJSONPolygonParser {
// we only handle doubles
try {
return Double.parseDouble(b.toString());
- } catch (
- @SuppressWarnings("unused")
- NumberFormatException nfe) {
+ } catch (NumberFormatException _) {
upto = uptoStart;
throw newParseException("could not parse number as double");
}
diff --git a/lucene/core/src/java/org/apache/lucene/geo/SimpleWKTShapeParser.java b/lucene/core/src/java/org/apache/lucene/geo/SimpleWKTShapeParser.java
index 83d9e5fe8b9..ac98f620a19 100644
--- a/lucene/core/src/java/org/apache/lucene/geo/SimpleWKTShapeParser.java
+++ b/lucene/core/src/java/org/apache/lucene/geo/SimpleWKTShapeParser.java
@@ -302,9 +302,7 @@ public class SimpleWKTShapeParser {
} else {
try {
return Double.parseDouble(stream.sval);
- } catch (
- @SuppressWarnings("unused")
- NumberFormatException e) {
+ } catch (NumberFormatException _) {
throw new ParseException("invalid number found: " + stream.sval, stream.lineno());
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
index 7e98e51bf69..034d27b58e2 100644
--- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
+++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
@@ -1674,9 +1674,7 @@ public final class CheckIndex implements Closeable {
long ord = -1;
try {
ord = termsEnum.ord();
- } catch (
- @SuppressWarnings("unused")
- UnsupportedOperationException uoe) {
+ } catch (UnsupportedOperationException _) {
hasOrd = false;
}
diff --git a/lucene/core/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java b/lucene/core/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java
index e2d5ee569b1..39a7ff3a401 100644
--- a/lucene/core/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java
+++ b/lucene/core/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java
@@ -177,9 +177,7 @@ public class ConcurrentMergeScheduler extends MergeScheduler {
if (value != null) {
coreCount = Integer.parseInt(value);
}
- } catch (
- @SuppressWarnings("unused")
- Throwable ignored) {
+ } catch (Throwable _) {
}
// If you are indexing at full throttle, how many merge threads do you need to keep up? It
@@ -498,9 +496,7 @@ public class ConcurrentMergeScheduler extends MergeScheduler {
if (toSync != null) {
try {
toSync.join();
- } catch (
- @SuppressWarnings("unused")
- InterruptedException ie) {
+ } catch (InterruptedException _) {
// ignore this Exception, we will retry until all threads are dead
interrupted = true;
}
@@ -682,9 +678,7 @@ public class ConcurrentMergeScheduler extends MergeScheduler {
// Let CMS run new merges if necessary:
try {
merge(mergeSource, MergeTrigger.MERGE_FINISHED);
- } catch (
- @SuppressWarnings("unused")
- AlreadyClosedException ace) {
+ } catch (AlreadyClosedException _) {
// OK
} catch (IOException ioe) {
throw new UncheckedIOException(ioe);
diff --git a/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java b/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java
index 8f56ae49d3e..7f4a118ad02 100644
--- a/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java
+++ b/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java
@@ -280,7 +280,7 @@ public abstract class DirectoryReader extends BaseCompositeReader<LeafReader> {
// IOException allowed to throw there, in case
// segments_N is corrupt
sis = SegmentInfos.readCommit(dir, fileName, 0);
- } catch (@SuppressWarnings("unused") FileNotFoundException | NoSuchFileException fnfe) {
+ } catch (FileNotFoundException | NoSuchFileException _) {
// LUCENE-948: on NFS (and maybe others), if
// you have writers switching back and forth
// between machines, it's very likely that the
diff --git a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java b/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java
index ed3b9d0698d..df3e6458aed 100644
--- a/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java
+++ b/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java
@@ -682,9 +682,7 @@ final class DocumentsWriterFlushControl implements Accountable, Closeable {
try {
documentsWriter.subtractFlushedNumDocs(dwpt.getNumDocsInRAM());
dwpt.abort();
- } catch (
- @SuppressWarnings("unused")
- Exception ex) {
+ } catch (Exception _) {
// that's fine we just abort everything here this is best effort
} finally {
doAfterFlush(dwpt);
@@ -696,9 +694,7 @@ final class DocumentsWriterFlushControl implements Accountable, Closeable {
blockedFlush); // add the blockedFlushes for correct accounting in doAfterFlush
documentsWriter.subtractFlushedNumDocs(blockedFlush.getNumDocsInRAM());
blockedFlush.abort();
- } catch (
- @SuppressWarnings("unused")
- Exception ex) {
+ } catch (Exception _) {
// that's fine we just abort everything here this is best effort
} finally {
doAfterFlush(blockedFlush);
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java b/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java
index 57b5658927b..b78fc0dd74b 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java
@@ -273,9 +273,7 @@ final class IndexFileDeleter implements Closeable {
try {
maxSegmentGen =
Math.max(SegmentInfos.generationFromSegmentsFileName(fileName), maxSegmentGen);
- } catch (
- @SuppressWarnings("unused")
- NumberFormatException ignore) {
+ } catch (NumberFormatException _) {
// trash file: we have to handle this since we allow anything starting with 'segments'
// here
}
@@ -285,9 +283,7 @@ final class IndexFileDeleter implements Closeable {
Math.max(
SegmentInfos.generationFromSegmentsFileName(fileName.substring(8)),
maxSegmentGen);
- } catch (
- @SuppressWarnings("unused")
- NumberFormatException ignore) {
+ } catch (NumberFormatException _) {
// trash file: we have to handle this since we allow anything starting with
// 'pending_segments' here
}
@@ -310,9 +306,7 @@ final class IndexFileDeleter implements Closeable {
try {
curGen = Math.max(curGen, IndexFileNames.parseGeneration(fileName));
- } catch (
- @SuppressWarnings("unused")
- NumberFormatException ignore) {
+ } catch (NumberFormatException _) {
// trash file: we have to handle this since codec regex is only so good
}
maxPerSegmentGen.put(segmentName, curGen);
@@ -395,9 +389,7 @@ final class IndexFileDeleter implements Closeable {
try {
ensureOpen();
return false;
- } catch (
- @SuppressWarnings("unused")
- AlreadyClosedException ace) {
+ } catch (AlreadyClosedException _) {
return true;
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
index 4241bcedf46..1224bebc9d0 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
@@ -2639,8 +2639,7 @@ public class IndexWriter
*/
try {
synchronized (fullFlushLock) {
- try (@SuppressWarnings("unused")
- Closeable finalizer = docWriter.lockAndAbortAll()) {
+ try (Closeable _ = docWriter.lockAndAbortAll()) {
processEvents(false);
synchronized (this) {
try {
@@ -5875,9 +5874,7 @@ public class IndexWriter
Collection<String> files;
try {
files = info.files();
- } catch (
- @SuppressWarnings("unused")
- IllegalStateException ise) {
+ } catch (IllegalStateException _) {
// OK
files = null;
}
diff --git a/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java b/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
index 50af192671a..7c14a34c127 100644
--- a/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
+++ b/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
@@ -427,7 +427,7 @@ public abstract class MergePolicy {
return true;
} catch (InterruptedException e) {
throw new ThreadInterruptedException(e);
- } catch (@SuppressWarnings("unused") ExecutionException | TimeoutException e) {
+ } catch (ExecutionException | TimeoutException _) {
return false;
}
}
@@ -529,7 +529,7 @@ public abstract class MergePolicy {
return true;
} catch (InterruptedException e) {
throw new ThreadInterruptedException(e);
- } catch (@SuppressWarnings("unused") ExecutionException | CancellationException e) {
+ } catch (ExecutionException | CancellationException _) {
return false;
}
}
@@ -542,7 +542,7 @@ public abstract class MergePolicy {
return true;
} catch (InterruptedException e) {
throw new ThreadInterruptedException(e);
- } catch (@SuppressWarnings("unused") ExecutionException | TimeoutException e) {
+ } catch (ExecutionException | TimeoutException _) {
return false;
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/index/MultiIndexMergeScheduler.java b/lucene/core/src/java/org/apache/lucene/index/MultiIndexMergeScheduler.java
index 84b88aafbc9..381b11b8594 100644
--- a/lucene/core/src/java/org/apache/lucene/index/MultiIndexMergeScheduler.java
+++ b/lucene/core/src/java/org/apache/lucene/index/MultiIndexMergeScheduler.java
@@ -188,9 +188,7 @@ class MultiIndexMergeScheduler extends MergeScheduler {
if (toSync != null) {
try {
toSync.join();
- } catch (
- @SuppressWarnings("unused")
- InterruptedException ie) {
+ } catch (InterruptedException _) {
// ignore this Exception, we will retry until all threads are dead
interrupted = true;
}
diff --git a/lucene/core/src/java/org/apache/lucene/index/StandardDirectoryReader.java b/lucene/core/src/java/org/apache/lucene/index/StandardDirectoryReader.java
index dd6d9716c4a..fbdf8895747 100644
--- a/lucene/core/src/java/org/apache/lucene/index/StandardDirectoryReader.java
+++ b/lucene/core/src/java/org/apache/lucene/index/StandardDirectoryReader.java
@@ -455,9 +455,7 @@ public final class StandardDirectoryReader extends DirectoryReader {
if (writer != null) {
try {
writer.decRefDeleter(segmentInfos);
- } catch (
- @SuppressWarnings("unused")
- AlreadyClosedException ex) {
+ } catch (AlreadyClosedException _) {
// This is OK, it just means our original writer was
// closed before we were, and this may leave some
// un-referenced files in the index, which is
diff --git a/lucene/core/src/java/org/apache/lucene/index/Term.java b/lucene/core/src/java/org/apache/lucene/index/Term.java
index 6baa34cdf8c..92575dd3d12 100644
--- a/lucene/core/src/java/org/apache/lucene/index/Term.java
+++ b/lucene/core/src/java/org/apache/lucene/index/Term.java
@@ -116,9 +116,7 @@ public final class Term implements Comparable<Term>, Accountable {
return decoder
.decode(ByteBuffer.wrap(termText.bytes, termText.offset, termText.length))
.toString();
- } catch (
- @SuppressWarnings("unused")
- CharacterCodingException e) {
+ } catch (CharacterCodingException _) {
return termText.toString();
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/index/Terms.java b/lucene/core/src/java/org/apache/lucene/index/Terms.java
index 4343eedf20c..4ef9d7541cf 100644
--- a/lucene/core/src/java/org/apache/lucene/index/Terms.java
+++ b/lucene/core/src/java/org/apache/lucene/index/Terms.java
@@ -165,9 +165,7 @@ public abstract class Terms {
TermsEnum iterator = iterator();
iterator.seekExact(size - 1);
return iterator.term();
- } catch (
- @SuppressWarnings("unused")
- UnsupportedOperationException ignored) {
+ } catch (UnsupportedOperationException _) {
// ok
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/index/TwoPhaseCommitTool.java b/lucene/core/src/java/org/apache/lucene/index/TwoPhaseCommitTool.java
index e482faba6b3..09d69d32e25 100644
--- a/lucene/core/src/java/org/apache/lucene/index/TwoPhaseCommitTool.java
+++ b/lucene/core/src/java/org/apache/lucene/index/TwoPhaseCommitTool.java
@@ -61,9 +61,7 @@ public final class TwoPhaseCommitTool {
if (tpc != null) {
try {
tpc.rollback();
- } catch (
- @SuppressWarnings("unused")
- Throwable t) {
+ } catch (Throwable _) {
}
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java b/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java
index 69b3e040242..f4829327d44 100644
--- a/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java
+++ b/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java
@@ -56,9 +56,7 @@ public abstract class VectorizationProvider {
.filter(Predicate.not(Set.of("", "default")::contains))
.mapToInt(Integer::parseInt)
.findAny();
- } catch (
- @SuppressWarnings("unused")
- SecurityException se) {
+ } catch (SecurityException _) {
// ignored
}
TESTS_VECTOR_SIZE = vs;
@@ -75,7 +73,7 @@ public abstract class VectorizationProvider {
if (str != null) {
runtimeVersion = Math.max(Integer.parseInt(str), runtimeVersion);
}
- } catch (@SuppressWarnings("unused") NumberFormatException | SecurityException ignored) {
+ } catch (NumberFormatException | SecurityException _) {
Logger.getLogger(VectorizationProvider.class.getName())
.warning(
"Cannot read sysprop "
diff --git a/lucene/core/src/java/org/apache/lucene/search/ControlledRealTimeReopenThread.java b/lucene/core/src/java/org/apache/lucene/search/ControlledRealTimeReopenThread.java
index 997e52423d5..4164e77bf94 100644
--- a/lucene/core/src/java/org/apache/lucene/search/ControlledRealTimeReopenThread.java
+++ b/lucene/core/src/java/org/apache/lucene/search/ControlledRealTimeReopenThread.java
@@ -213,9 +213,7 @@ public class ControlledRealTimeReopenThread<T> extends Thread implements Closeab
} else {
break;
}
- } catch (
- @SuppressWarnings("unused")
- InterruptedException ie) {
+ } catch (InterruptedException _) {
Thread.currentThread().interrupt();
return;
} finally {
diff --git a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
index 71d72d68214..d1079b69089 100644
--- a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
+++ b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
@@ -823,9 +823,7 @@ public class IndexSearcher {
final LeafCollector leafCollector;
try {
leafCollector = collector.getLeafCollector(ctx);
- } catch (
- @SuppressWarnings("unused")
- CollectionTerminatedException e) {
+ } catch (CollectionTerminatedException _) {
// there is no doc of interest in this reader context
// continue with the following leaf
return;
@@ -841,14 +839,10 @@ public class IndexSearcher {
// Optimize for the case when live docs are stored in a FixedBitSet.
Bits acceptDocs = ScorerUtil.likelyLiveDocs(ctx.reader().getLiveDocs());
scorer.score(leafCollector, acceptDocs, minDocId, maxDocId);
- } catch (
- @SuppressWarnings("unused")
- CollectionTerminatedException e) {
+ } catch (CollectionTerminatedException _) {
// collection was terminated prematurely
// continue with the following leaf
- } catch (
- @SuppressWarnings("unused")
- TimeLimitingBulkScorer.TimeExceededException e) {
+ } catch (TimeLimitingBulkScorer.TimeExceededException _) {
partialResult = true;
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/search/MultiCollector.java b/lucene/core/src/java/org/apache/lucene/search/MultiCollector.java
index c08f8cdee7e..62ad2887449 100644
--- a/lucene/core/src/java/org/apache/lucene/search/MultiCollector.java
+++ b/lucene/core/src/java/org/apache/lucene/search/MultiCollector.java
@@ -128,9 +128,7 @@ public class MultiCollector implements Collector {
final LeafCollector leafCollector;
try {
leafCollector = collector.getLeafCollector(context);
- } catch (
- @SuppressWarnings("unused")
- CollectionTerminatedException e) {
+ } catch (CollectionTerminatedException _) {
// this leaf collector does not need this segment
continue;
}
@@ -219,9 +217,7 @@ public class MultiCollector implements Collector {
if (collector != null) {
try {
collector.collect(doc);
- } catch (
- @SuppressWarnings("unused")
- CollectionTerminatedException e) {
+ } catch (CollectionTerminatedException _) {
collectors[i].finish();
collectors[i] = null;
if (allCollectorsTerminated()) {
diff --git a/lucene/core/src/java/org/apache/lucene/search/SeededKnnVectorQuery.java b/lucene/core/src/java/org/apache/lucene/search/SeededKnnVectorQuery.java
index 2b43b6c0b63..d75edaf7a25 100644
--- a/lucene/core/src/java/org/apache/lucene/search/SeededKnnVectorQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/SeededKnnVectorQuery.java
@@ -327,9 +327,7 @@ public class SeededKnnVectorQuery extends AbstractKnnVectorQuery {
0 /* min */,
DocIdSetIterator.NO_MORE_DOCS /* max */);
}
- } catch (
- @SuppressWarnings("unused")
- CollectionTerminatedException e) {
+ } catch (CollectionTerminatedException _) {
}
leafCollector.finish();
}
diff --git a/lucene/core/src/java/org/apache/lucene/search/TaskExecutor.java b/lucene/core/src/java/org/apache/lucene/search/TaskExecutor.java
index 6c89c267a52..3c76525ae62 100644
--- a/lucene/core/src/java/org/apache/lucene/search/TaskExecutor.java
+++ b/lucene/core/src/java/org/apache/lucene/search/TaskExecutor.java
@@ -58,9 +58,7 @@ public final class TaskExecutor {
r -> {
try {
executor.execute(r);
- } catch (
- @SuppressWarnings("unused")
- RejectedExecutionException rejectedExecutionException) {
+ } catch (RejectedExecutionException _) {
// execute directly on the current thread in case of rejection to ensure a rejecting
// executor only reduces parallelism and does not
// result in failure
diff --git a/lucene/core/src/java/org/apache/lucene/store/ByteArrayDataInput.java b/lucene/core/src/java/org/apache/lucene/store/ByteArrayDataInput.java
index afa2b635be6..e7256fbe2ef 100644
--- a/lucene/core/src/java/org/apache/lucene/store/ByteArrayDataInput.java
+++ b/lucene/core/src/java/org/apache/lucene/store/ByteArrayDataInput.java
@@ -112,9 +112,7 @@ public final class ByteArrayDataInput extends DataInput {
public int readVInt() {
try {
return super.readVInt();
- } catch (
- @SuppressWarnings("unused")
- IOException e) {
+ } catch (IOException _) {
throw new AssertionError("ByteArrayDataInput#readByte should not throw IOException");
}
}
@@ -123,9 +121,7 @@ public final class ByteArrayDataInput extends DataInput {
public long readVLong() {
try {
return super.readVLong();
- } catch (
- @SuppressWarnings("unused")
- IOException e) {
+ } catch (IOException _) {
throw new AssertionError("ByteArrayDataInput#readByte should not throw IOException");
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java b/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
index 5039c779097..ab12b8ae610 100644
--- a/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/FSDirectory.java
@@ -227,9 +227,7 @@ public abstract class FSDirectory extends BaseDirectory {
continue;
}
return new FSIndexOutput(name, StandardOpenOption.WRITE, StandardOpenOption.CREATE_NEW);
- } catch (
- @SuppressWarnings("unused")
- FileAlreadyExistsException faee) {
+ } catch (FileAlreadyExistsException _) {
// Retry with next incremented name
}
}
@@ -354,9 +352,7 @@ public abstract class FSDirectory extends BaseDirectory {
} else {
throw e;
}
- } catch (
- @SuppressWarnings("unused")
- IOException ioe) {
+ } catch (IOException _) {
// On windows, a file delete can fail because there's still an open
// file handle against it. We record this in pendingDeletes and
// try again later.
diff --git a/lucene/core/src/java/org/apache/lucene/store/LockStressTest.java b/lucene/core/src/java/org/apache/lucene/store/LockStressTest.java
index 56d2888b83c..adbf2e0d7b5 100644
--- a/lucene/core/src/java/org/apache/lucene/store/LockStressTest.java
+++ b/lucene/core/src/java/org/apache/lucene/store/LockStressTest.java
@@ -125,16 +125,12 @@ public class LockStressTest {
}
try (var _ = verifyLF.obtainLock(lockDir, LOCK_FILE_NAME)) {
throw new IOException("Double obtain");
- } catch (
- @SuppressWarnings("unused")
- LockObtainFailedException loe) {
+ } catch (LockObtainFailedException _) {
// pass
}
}
Thread.sleep(sleepTimeMS);
- } catch (
- @SuppressWarnings("unused")
- LockObtainFailedException loe) {
+ } catch (LockObtainFailedException _) {
// obtain failed
}
@@ -154,9 +150,7 @@ public class LockStressTest {
// try to get static INSTANCE field of class
try {
return (FSLockFactory) Class.forName(lockFactoryClassName).getField("INSTANCE").get(null);
- } catch (
- @SuppressWarnings("unused")
- ReflectiveOperationException e) {
+ } catch (ReflectiveOperationException _) {
// fall-through
}
@@ -166,7 +160,7 @@ public class LockStressTest {
.asSubclass(FSLockFactory.class)
.getConstructor()
.newInstance();
- } catch (@SuppressWarnings("unused") ReflectiveOperationException | ClassCastException e) {
+ } catch (ReflectiveOperationException | ClassCastException _) {
// fall-through
}
diff --git a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
index 16ee1bcc01c..97b9538b134 100644
--- a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java
@@ -133,9 +133,7 @@ public class MMapDirectory extends FSDirectory {
if (IndexFileNames.parseGeneration(filename) > 0) {
groupKey += "-g";
}
- } catch (
- @SuppressWarnings("unused")
- NumberFormatException unused) {
+ } catch (NumberFormatException _) {
// does not confirm to the generation syntax, or trash
}
return Optional.of(groupKey);
@@ -494,7 +492,7 @@ public class MMapDirectory extends FSDirectory {
if (str != null) {
ret = Integer.parseInt(str);
}
- } catch (@SuppressWarnings("unused") NumberFormatException | SecurityException ignored) {
+ } catch (NumberFormatException | SecurityException _) {
Logger.getLogger(MMapDirectory.class.getName())
.warning(
"Cannot read sysprop "
diff --git a/lucene/core/src/java/org/apache/lucene/store/MemorySegmentIndexInput.java b/lucene/core/src/java/org/apache/lucene/store/MemorySegmentIndexInput.java
index 28f2be0b216..03cfc068106 100644
--- a/lucene/core/src/java/org/apache/lucene/store/MemorySegmentIndexInput.java
+++ b/lucene/core/src/java/org/apache/lucene/store/MemorySegmentIndexInput.java
@@ -156,9 +156,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
final byte v = curSegment.get(LAYOUT_BYTE, curPosition);
curPosition++;
return v;
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException e) {
+ } catch (IndexOutOfBoundsException _) {
do {
curSegmentIndex++;
if (curSegmentIndex >= segments.length) {
@@ -180,9 +178,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
try {
MemorySegment.copy(curSegment, LAYOUT_BYTE, curPosition, b, offset, len);
curPosition += len;
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException e) {
+ } catch (IndexOutOfBoundsException _) {
readBytesBoundary(b, offset, len);
} catch (NullPointerException | IllegalStateException e) {
throw alreadyClosed(e);
@@ -216,9 +212,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
try {
MemorySegment.copy(curSegment, LAYOUT_LE_INT, curPosition, dst, offset, length);
curPosition += Integer.BYTES * (long) length;
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException iobe) {
+ } catch (IndexOutOfBoundsException _) {
super.readInts(dst, offset, length);
} catch (NullPointerException | IllegalStateException e) {
throw alreadyClosed(e);
@@ -230,9 +224,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
try {
MemorySegment.copy(curSegment, LAYOUT_LE_LONG, curPosition, dst, offset, length);
curPosition += Long.BYTES * (long) length;
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException iobe) {
+ } catch (IndexOutOfBoundsException _) {
super.readLongs(dst, offset, length);
} catch (NullPointerException | IllegalStateException e) {
throw alreadyClosed(e);
@@ -244,9 +236,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
try {
MemorySegment.copy(curSegment, LAYOUT_LE_FLOAT, curPosition, dst, offset, length);
curPosition += Float.BYTES * (long) length;
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException iobe) {
+ } catch (IndexOutOfBoundsException _) {
super.readFloats(dst, offset, length);
} catch (NullPointerException | IllegalStateException e) {
throw alreadyClosed(e);
@@ -259,9 +249,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
final short v = curSegment.get(LAYOUT_LE_SHORT, curPosition);
curPosition += Short.BYTES;
return v;
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException e) {
+ } catch (IndexOutOfBoundsException _) {
return super.readShort();
} catch (NullPointerException | IllegalStateException e) {
throw alreadyClosed(e);
@@ -274,9 +262,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
final int v = curSegment.get(LAYOUT_LE_INT, curPosition);
curPosition += Integer.BYTES;
return v;
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException e) {
+ } catch (IndexOutOfBoundsException _) {
return super.readInt();
} catch (NullPointerException | IllegalStateException e) {
throw alreadyClosed(e);
@@ -301,9 +287,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
final long v = curSegment.get(LAYOUT_LE_LONG, curPosition);
curPosition += Long.BYTES;
return v;
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException e) {
+ } catch (IndexOutOfBoundsException _) {
return super.readLong();
} catch (NullPointerException | IllegalStateException e) {
throw alreadyClosed(e);
@@ -418,9 +402,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
final MemorySegment advisedSlice = segment.asSlice(offset, length);
advice.accept(advisedSlice);
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException e) {
+ } catch (IndexOutOfBoundsException _) {
throw new EOFException("Read past EOF: " + this);
} catch (NullPointerException | IllegalStateException e) {
throw alreadyClosed(e);
@@ -520,9 +502,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
final int si = (int) (pos >> chunkSizePower);
try {
return segments[si].get(LAYOUT_LE_SHORT, pos & chunkSizeMask);
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException ioobe) {
+ } catch (IndexOutOfBoundsException _) {
// either it's a boundary, or read past EOF, fall back:
setPos(pos, si);
return readShort();
@@ -536,9 +516,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
final int si = (int) (pos >> chunkSizePower);
try {
return segments[si].get(LAYOUT_LE_INT, pos & chunkSizeMask);
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException ioobe) {
+ } catch (IndexOutOfBoundsException _) {
// either it's a boundary, or read past EOF, fall back:
setPos(pos, si);
return readInt();
@@ -552,9 +530,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
final int si = (int) (pos >> chunkSizePower);
try {
return segments[si].get(LAYOUT_LE_LONG, pos & chunkSizeMask);
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException ioobe) {
+ } catch (IndexOutOfBoundsException _) {
// either it's a boundary, or read past EOF, fall back:
setPos(pos, si);
return readLong();
@@ -717,9 +693,7 @@ abstract class MemorySegmentIndexInput extends IndexInput implements MemorySegme
try {
arena.close();
break;
- } catch (
- @SuppressWarnings("unused")
- IllegalStateException e) {
+ } catch (IllegalStateException _) {
Thread.onSpinWait();
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/store/NRTCachingDirectory.java b/lucene/core/src/java/org/apache/lucene/store/NRTCachingDirectory.java
index 35a300c1763..12a0fe8cae6 100644
--- a/lucene/core/src/java/org/apache/lucene/store/NRTCachingDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/NRTCachingDirectory.java
@@ -299,7 +299,7 @@ public class NRTCachingDirectory extends FilterDirectory implements Accountable
try {
dir.fileLength(fileName);
return true;
- } catch (@SuppressWarnings("unused") NoSuchFileException | FileNotFoundException e) {
+ } catch (NoSuchFileException | FileNotFoundException _) {
return false;
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/store/PosixNativeAccess.java b/lucene/core/src/java/org/apache/lucene/store/PosixNativeAccess.java
index c84ecae7d2c..1ab0169f244 100644
--- a/lucene/core/src/java/org/apache/lucene/store/PosixNativeAccess.java
+++ b/lucene/core/src/java/org/apache/lucene/store/PosixNativeAccess.java
@@ -71,9 +71,7 @@ final class PosixNativeAccess extends NativeAccess {
instance = new PosixNativeAccess();
} catch (UnsupportedOperationException uoe) {
LOG.warning(uoe.getMessage());
- } catch (
- @SuppressWarnings("unused")
- IllegalCallerException ice) {
+ } catch (IllegalCallerException _) {
LOG.warning(
String.format(
Locale.ENGLISH,
diff --git a/lucene/core/src/java/org/apache/lucene/util/BitUtil.java b/lucene/core/src/java/org/apache/lucene/util/BitUtil.java
index 2389e3b0485..3d82fd95015 100644
--- a/lucene/core/src/java/org/apache/lucene/util/BitUtil.java
+++ b/lucene/core/src/java/org/apache/lucene/util/BitUtil.java
@@ -44,9 +44,7 @@ public final class BitUtil {
if (prop != null) {
return (prop.hashCode() % 2 == 0) ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN;
}
- } catch (
- @SuppressWarnings("unused")
- SecurityException se) {
+ } catch (SecurityException _) {
// fall-through
}
return ByteOrder.nativeOrder();
diff --git a/lucene/core/src/java/org/apache/lucene/util/ClassLoaderUtils.java b/lucene/core/src/java/org/apache/lucene/util/ClassLoaderUtils.java
index 78938e81238..2e6b789682c 100644
--- a/lucene/core/src/java/org/apache/lucene/util/ClassLoaderUtils.java
+++ b/lucene/core/src/java/org/apache/lucene/util/ClassLoaderUtils.java
@@ -42,9 +42,7 @@ public interface ClassLoaderUtils {
cl = cl.getParent();
}
return false;
- } catch (
- @SuppressWarnings("unused")
- SecurityException se) {
+ } catch (SecurityException _) {
return false;
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/util/HotspotVMOptions.java b/lucene/core/src/java/org/apache/lucene/util/HotspotVMOptions.java
index 8722ffe914f..c8d17a034ee 100644
--- a/lucene/core/src/java/org/apache/lucene/util/HotspotVMOptions.java
+++ b/lucene/core/src/java/org/apache/lucene/util/HotspotVMOptions.java
@@ -61,14 +61,12 @@ final class HotspotVMOptions {
try {
final Object vmOption = getVMOptionMethod.invoke(hotSpotBean, name);
return Optional.of(getValueMethod.invoke(vmOption).toString());
- } catch (@SuppressWarnings("unused")
- ReflectiveOperationException
- | RuntimeException e) {
+ } catch (ReflectiveOperationException | RuntimeException _) {
return Optional.empty();
}
};
}
- } catch (@SuppressWarnings("unused") ReflectiveOperationException | RuntimeException e) {
+ } catch (ReflectiveOperationException | RuntimeException _) {
isHotspot = false;
final Logger log = Logger.getLogger(HotspotVMOptions.class.getName());
final Module module = HotspotVMOptions.class.getModule();
diff --git a/lucene/core/src/java/org/apache/lucene/util/IOUtils.java b/lucene/core/src/java/org/apache/lucene/util/IOUtils.java
index 159139d5602..d257dc24cf0 100644
--- a/lucene/core/src/java/org/apache/lucene/util/IOUtils.java
+++ b/lucene/core/src/java/org/apache/lucene/util/IOUtils.java
@@ -224,9 +224,7 @@ public final class IOUtils {
for (String name : files) {
try {
dir.deleteFile(name);
- } catch (
- @SuppressWarnings("unused")
- Throwable ignored) {
+ } catch (Throwable _) {
// ignore
}
}
@@ -323,9 +321,7 @@ public final class IOUtils {
if (name != null) {
try {
Files.delete(name);
- } catch (
- @SuppressWarnings("unused")
- Throwable ignored) {
+ } catch (Throwable _) {
// ignore
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/util/StringHelper.java b/lucene/core/src/java/org/apache/lucene/util/StringHelper.java
index c4e0b5227ef..2b75e2dd662 100644
--- a/lucene/core/src/java/org/apache/lucene/util/StringHelper.java
+++ b/lucene/core/src/java/org/apache/lucene/util/StringHelper.java
@@ -392,9 +392,7 @@ public abstract class StringHelper {
new DataInputStream(Files.newInputStream(Paths.get("/dev/urandom")))) {
x0 = is.readLong();
x1 = is.readLong();
- } catch (
- @SuppressWarnings("unused")
- Exception unavailable) {
+ } catch (Exception _) {
// may not be available on this platform
// fall back to lower quality randomness from 3 different sources:
x0 = System.nanoTime();
@@ -409,9 +407,7 @@ public abstract class StringHelper {
sb.append(p.getProperty(s));
}
x1 |= sb.toString().hashCode();
- } catch (
- @SuppressWarnings("unused")
- SecurityException notallowed) {
+ } catch (SecurityException _) {
// getting Properties requires wildcard read-write: may not be allowed
x1 |= StringBuffer.class.hashCode();
}
diff --git a/lucene/core/src/java/org/apache/lucene/util/UnicodeUtil.java b/lucene/core/src/java/org/apache/lucene/util/UnicodeUtil.java
index 4ac05aae975..bf719377b18 100644
--- a/lucene/core/src/java/org/apache/lucene/util/UnicodeUtil.java
+++ b/lucene/core/src/java/org/apache/lucene/util/UnicodeUtil.java
@@ -585,9 +585,7 @@ public final class UnicodeUtil {
w += 2;
}
break;
- } catch (
- @SuppressWarnings("unused")
- IndexOutOfBoundsException ex) {
+ } catch (IndexOutOfBoundsException _) {
int newlen = (int) (Math.ceil((double) codePoints.length * (w + 2) / (r - offset + 1)));
char[] temp = new char[newlen];
System.arraycopy(chars, 0, temp, 0, w);
diff --git a/lucene/core/src/java/org/apache/lucene/util/VirtualMethod.java b/lucene/core/src/java/org/apache/lucene/util/VirtualMethod.java
index fc3a649058c..7c6c357862e 100644
--- a/lucene/core/src/java/org/apache/lucene/util/VirtualMethod.java
+++ b/lucene/core/src/java/org/apache/lucene/util/VirtualMethod.java
@@ -140,9 +140,7 @@ public final class VirtualMethod<C> {
try {
clazz.getDeclaredMethod(method, parameters);
overridden = true;
- } catch (
- @SuppressWarnings("unused")
- NoSuchMethodException nsme) {
+ } catch (NoSuchMethodException _) {
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/util/bkd/OfflinePointReader.java b/lucene/core/src/java/org/apache/lucene/util/bkd/OfflinePointReader.java
index 0b2306cb9d3..25b4586ca0d 100644
--- a/lucene/core/src/java/org/apache/lucene/util/bkd/OfflinePointReader.java
+++ b/lucene/core/src/java/org/apache/lucene/util/bkd/OfflinePointReader.java
@@ -122,9 +122,7 @@ public final class OfflinePointReader implements PointReader {
countLeft = 0;
}
this.offset = 0;
- } catch (
- @SuppressWarnings("unused")
- EOFException eofe) {
+ } catch (EOFException _) {
assert countLeft == -1;
return false;
}
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
index 8f64a5678d6..ce0733e5df4 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java
@@ -748,9 +748,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
for (final TraversalStrategy ts : traversalStrategies) {
try {
return ts.apply(testPoint, testPointInSet, x, y, z);
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
// Continue
}
}
@@ -897,9 +895,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
// System.out.println(" creating sector linear crossing edge iterator");
return new SectorLinearCrossingEdgeIterator(
testPoint, plane, abovePlane, belowPlane, thePointX, thePointY, thePointZ);
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
// Assume we failed because we could not construct bounding planes, so do it another way.
// System.out.println(" create full linear crossing edge iterator");
return new FullLinearCrossingEdgeIterator(
@@ -1061,9 +1057,7 @@ class GeoComplexPolygon extends GeoBasePolygon {
// System.out.println(" Check point in set? " + rval);
return rval;
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
// Intersection point apparently was on edge, so try another strategy
// System.out.println(" Trying dual crossing edge iterator");
final CountingEdgeIterator edgeIterator =
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java
index 81e0d3f2d02..b9dc110b6cc 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java
@@ -235,9 +235,7 @@ public class GeoPolygonFactory {
}
throw new IllegalArgumentException(
"cannot find a point that is inside the polygon " + filteredPointList);
- } catch (
- @SuppressWarnings("unused")
- TileException e) {
+ } catch (TileException _) {
// Couldn't tile the polygon; use GeoComplexPolygon instead, if we can.
}
}
@@ -518,9 +516,7 @@ public class GeoPolygonFactory {
new GeoPoint(-testPoint.x, -testPoint.y, -testPoint.z),
!isTestPointInside);
}
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
// Probably bad choice of test point.
return null;
}
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.java
index 292ead35732..82b56ecd7e1 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.java
@@ -220,9 +220,7 @@ public class SidedPlane extends Plane implements Membership {
// To construct the plane, we now just need D, which is simply the negative of the evaluation
// of the circle normal vector at one of the points.
return new SidedPlane(insidePoint, newNormalVector, -newNormalVector.dotProduct(point1));
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
return null;
}
}
@@ -263,9 +261,7 @@ public class SidedPlane extends Plane implements Membership {
point2.y - point3.y,
point2.z - point3.z);
rval = new SidedPlane(insidePoint, planeNormal, -planeNormal.dotProduct(point2));
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
}
if (rval == null) {
@@ -279,9 +275,7 @@ public class SidedPlane extends Plane implements Membership {
point3.y - point2.y,
point3.z - point2.z);
rval = new SidedPlane(insidePoint, planeNormal, -planeNormal.dotProduct(point3));
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
}
}
@@ -296,9 +290,7 @@ public class SidedPlane extends Plane implements Membership {
point1.y - point2.y,
point1.z - point2.z);
rval = new SidedPlane(insidePoint, planeNormal, -planeNormal.dotProduct(point1));
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
}
}
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
index 761b8c5c31e..e306dda300a 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/TestGeo3DPoint.java
@@ -761,9 +761,7 @@ public class TestGeo3DPoint extends LuceneTestCase {
// System.err.println("Generated: "+q);
// assertTrue(false);
return q;
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
continue;
}
}
@@ -788,9 +786,7 @@ public class TestGeo3DPoint extends LuceneTestCase {
// System.err.println("Generated: "+q);
// assertTrue(false);
return q;
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
continue;
}
}
@@ -807,9 +803,7 @@ public class TestGeo3DPoint extends LuceneTestCase {
GeoTestUtil.nextLatitude(),
GeoTestUtil.nextLongitude(),
widthMeters);
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
continue;
}
}
@@ -821,9 +815,7 @@ public class TestGeo3DPoint extends LuceneTestCase {
try {
return Geo3DPoint.newBoxQuery(
field, planetModel, r.minLat, r.maxLat, r.minLon, r.maxLon);
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
continue;
}
}
@@ -843,9 +835,7 @@ public class TestGeo3DPoint extends LuceneTestCase {
}
try {
return Geo3DPoint.newPathQuery(field, latitudes, longitudes, width, planetModel);
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
// This is what happens when we create a shape that is invalid. Although it is
// conceivable that there are cases where
// the exception is thrown incorrectly, we aren't going to be able to do that in this
@@ -885,9 +875,7 @@ public class TestGeo3DPoint extends LuceneTestCase {
continue;
}
return rval;
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
// This is what happens when we create a shape that is invalid. Although it is
// conceivable that there are cases where
// the exception is thrown incorrectly, we aren't going to be able to do that in this
@@ -907,9 +895,7 @@ public class TestGeo3DPoint extends LuceneTestCase {
try {
return GeoCircleFactory.makeGeoCircle(planetModel, lat, lon, angle);
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException iae) {
+ } catch (IllegalArgumentException _) {
// angle is too small; try again:
continue;
}
@@ -951,9 +937,7 @@ public class TestGeo3DPoint extends LuceneTestCase {
}
try {
return GeoPathFactory.makeGeoPath(planetModel, width, points);
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
// This is what happens when we create a shape that is invalid. Although it is
// conceivable that there are cases where
// the exception is thrown incorrectly, we aren't going to be able to do that in this
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoPath.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoPath.java
index f93466bef61..d3eec25bb02 100755
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoPath.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoPath.java
@@ -358,9 +358,7 @@ public class TestGeoPath extends LuceneTestCase {
final GeoPath path;
try {
path = GeoPathFactory.makeGeoPath(PlanetModel.WGS84, 1.117010721276371, points);
- } catch (
- @SuppressWarnings("unused")
- IllegalArgumentException e) {
+ } catch (IllegalArgumentException _) {
return;
}
assertTrue(false);
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoPolygon.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoPolygon.java
index 4dde79c8784..712c5c411fc 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoPolygon.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoPolygon.java
@@ -49,9 +49,7 @@ public class TestRandomGeoPolygon extends LuceneTestCase {
try {
GeoPolygon polygon = GeoPolygonFactory.makeGeoPolygon(planetModel, points);
assertTrue(polygon != null);
- } catch (
- @SuppressWarnings("unused")
- Exception e) {
+ } catch (Exception _) {
fail(points.toString());
}
}
@@ -68,9 +66,7 @@ public class TestRandomGeoPolygon extends LuceneTestCase {
points.add(point4);
try {
GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points);
- } catch (
- @SuppressWarnings("unused")
- Exception e) {
+ } catch (Exception _) {
fail(points.toString());
}
}