diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LineDocSource.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LineDocSource.java index 3b8b780ee02..9d70acfa176 100644 --- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LineDocSource.java +++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/LineDocSource.java @@ -250,7 +250,7 @@ public class LineDocSource extends ContentSource { try { final Class clazz = Class.forName(docDataLineReaderClassName).asSubclass(LineParser.class); - Constructor cnstr = clazz.getConstructor(new Class[]{String[].class}); + Constructor cnstr = clazz.getConstructor(String[].class); return cnstr.newInstance((Object)header); } catch (Exception e) { throw new RuntimeException("Failed to instantiate "+docDataLineReaderClassName, e); diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AnalyzerFactoryTask.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AnalyzerFactoryTask.java index ef31fbfb4f2..672ea0d7d52 100644 --- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AnalyzerFactoryTask.java +++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/AnalyzerFactoryTask.java @@ -112,6 +112,7 @@ public class AnalyzerFactoryTask extends PerfTask { * and 0+ TokenFilterFactory's */ @Override + @SuppressWarnings("fallthrough") public void setParams(String params) { super.setParams(params); ArgType expectedArgType = ArgType.ANALYZER_ARG; @@ -287,6 +288,7 @@ public class AnalyzerFactoryTask extends PerfTask { * @param stok stream tokenizer from which to draw analysis factory params * @param clazz analysis factory class to instantiate */ + @SuppressWarnings("fallthrough") private void createAnalysisPipelineComponent (StreamTokenizer stok, Class clazz) { Map argMap = new HashMap<>(); diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewCollationAnalyzerTask.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewCollationAnalyzerTask.java index ab06044bef8..aa90c2ec9f0 100644 --- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewCollationAnalyzerTask.java +++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewCollationAnalyzerTask.java @@ -65,8 +65,7 @@ public class NewCollationAnalyzerTask extends PerfTask { static Analyzer createAnalyzer(Locale locale, Implementation impl) throws Exception { final Class collatorClazz = Class.forName(impl.collatorClassName); - Method collatorMethod = collatorClazz.getMethod("getInstance", - new Class[] {Locale.class}); + Method collatorMethod = collatorClazz.getMethod("getInstance", Locale.class); Object collator = collatorMethod.invoke(null, locale); final Class clazz = Class.forName(impl.className) diff --git a/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java b/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java index facbf08d121..86fb0604c79 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java @@ -751,7 +751,7 @@ public final class MoreLikeThis { private PriorityQueue retrieveTerms(Map> fields) throws IOException { - HashMap termFreqMap = new HashMap(); + HashMap termFreqMap = new HashMap<>(); for (String fieldName : fieldNames) { for (String field : fields.keySet()) { Collection fieldValues = fields.get(field); diff --git a/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.java b/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.java index 2342457a7ce..b604d7971a7 100644 --- a/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.java +++ b/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.java @@ -44,6 +44,7 @@ import com.carrotsearch.randomizedtesting.generators.RandomInts; public class TestDocValuesFieldSources extends LuceneTestCase { + @SuppressWarnings("fallthrough") public void test(DocValuesType type) throws IOException { Directory d = newDirectory(); IndexWriterConfig iwConfig = newIndexWriterConfig(new MockAnalyzer(random())); @@ -126,6 +127,7 @@ public class TestDocValuesFieldSources extends LuceneTestCase { case SORTED: values.ordVal(i); // no exception assertTrue(values.numOrd() >= 1); + // fall-through case BINARY: assertEquals(expected, values.objectVal(i)); assertEquals(expected, values.strVal(i));