Skip to content

Commit ba7f659

Browse files
authored
Replacing unused variable suppress warning with _ (Part 2/5) (#15105)
--------- Signed-off-by: Ankit Jain <[email protected]>
1 parent 5534120 commit ba7f659

File tree

53 files changed

+103
-290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+103
-290
lines changed

lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SpatialFileQueryMaker.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ protected Query[] prepareQueries() throws Exception {
8282
i--; // skip
8383
}
8484
}
85-
} catch (
86-
@SuppressWarnings("unused")
87-
NoMoreDataException e) {
85+
} catch (NoMoreDataException _) {
8886
// all-done
8987
} finally {
9088
src.close();

lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ public int doLogic() throws IOException {
7979
String coreClassName = "org.apache.lucene.analysis.core." + analyzerName;
8080
analyzer = createAnalyzer(coreClassName);
8181
analyzerName = coreClassName;
82-
} catch (
83-
@SuppressWarnings("unused")
84-
ClassNotFoundException e) {
82+
} catch (ClassNotFoundException _) {
8583
// If not a core analyzer, try the base analysis package
8684
analyzerName = "org.apache.lucene.analysis." + analyzerName;
8785
analyzer = createAnalyzer(analyzerName);

lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/TaskSequence.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,7 @@ private int doSerialTasks() throws Exception {
206206
countsByTime[slot] += inc;
207207
}
208208
if (anyExhaustibleTasks) updateExhausted(task);
209-
} catch (
210-
@SuppressWarnings("unused")
211-
NoMoreDataException e) {
209+
} catch (NoMoreDataException _) {
212210
exhausted = true;
213211
}
214212
}
@@ -275,9 +273,7 @@ private int doSerialTasksWithRate() throws Exception {
275273
}
276274

277275
if (anyExhaustibleTasks) updateExhausted(task);
278-
} catch (
279-
@SuppressWarnings("unused")
280-
NoMoreDataException e) {
276+
} catch (NoMoreDataException _) {
281277
exhausted = true;
282278
}
283279
}
@@ -319,9 +315,7 @@ public void run() {
319315
updateExhausted(task);
320316
}
321317
count += n;
322-
} catch (
323-
@SuppressWarnings("unused")
324-
NoMoreDataException e) {
318+
} catch (NoMoreDataException _) {
325319
exhausted = true;
326320
} catch (Exception e) {
327321
throw new RuntimeException(e);

lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,7 @@ private Class<?> taskClass(Config config, String taskName) throws ClassNotFoundE
308308
for (String pkg : taskPackages) {
309309
try {
310310
return Class.forName(pkg + '.' + taskName + "Task");
311-
} catch (
312-
@SuppressWarnings("unused")
313-
ClassNotFoundException e) {
311+
} catch (ClassNotFoundException _) {
314312
// failed in this package, might succeed in the next one...
315313
}
316314
}

lucene/benchmark/src/java/org/apache/lucene/benchmark/quality/QualityQuery.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ public int compareTo(QualityQuery other) {
7474
int n = Integer.parseInt(queryID);
7575
int nOther = Integer.parseInt(other.queryID);
7676
return n - nOther;
77-
} catch (
78-
@SuppressWarnings("unused")
79-
NumberFormatException e) {
77+
} catch (NumberFormatException _) {
8078
// fall back to string comparison
8179
return queryID.compareTo(other.queryID);
8280
}

lucene/benchmark/src/java/org/apache/lucene/benchmark/utils/ExtractWikipedia.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ public void extract() throws Exception {
9696
doc.get(DocMaker.DATE_FIELD),
9797
doc.get(DocMaker.BODY_FIELD));
9898
}
99-
} catch (
100-
@SuppressWarnings("unused")
101-
NoMoreDataException e) {
99+
} catch (NoMoreDataException _) {
102100
// continue
103101
}
104102
long finish = System.currentTimeMillis();

lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/TestTrecContentSource.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,7 @@ public void testTrecFeedDirAllTypes() throws Exception {
424424
assertTrue("Should never get here!", false);
425425
}
426426
}
427-
} catch (
428-
@SuppressWarnings("unused")
429-
NoMoreDataException e) {
427+
} catch (NoMoreDataException _) {
430428
gotExpectedException = true;
431429
}
432430
assertTrue("Should have gotten NoMoreDataException!", gotExpectedException);

lucene/core/src/java/org/apache/lucene/analysis/TokenStream.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,7 @@ private boolean assertFinal() {
111111
|| Modifier.isFinal(clazz.getMethod("incrementToken").getModifiers())
112112
: "TokenStream implementation classes or at least their incrementToken() implementation must be final";
113113
return true;
114-
} catch (
115-
@SuppressWarnings("unused")
116-
NoSuchMethodException nsme) {
114+
} catch (NoSuchMethodException _) {
117115
return false;
118116
}
119117
}

lucene/core/src/java/org/apache/lucene/codecs/lucene103/blocktree/IntersectTermsEnum.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,7 @@ public Throwable fillInStackTrace() {
364364
public BytesRef next() throws IOException {
365365
try {
366366
return _next();
367-
} catch (
368-
@SuppressWarnings("unused")
369-
NoMoreTermsException eoi) {
367+
} catch (NoMoreTermsException _) {
370368
// Provoke NPE if we are (illegally!) called again:
371369
currentFrame = null;
372370
return null;

lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingStoredFieldsWriter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,7 @@ public void finish(int numDocs) throws IOException {
497497
boolean v = true;
498498
try {
499499
v = Boolean.parseBoolean(System.getProperty(BULK_MERGE_ENABLED_SYSPROP, "true"));
500-
} catch (
501-
@SuppressWarnings("unused")
502-
SecurityException ignored) {
500+
} catch (SecurityException _) {
503501
}
504502
BULK_MERGE_ENABLED = v;
505503
}

0 commit comments

Comments
 (0)