LUCENE-6740: Reduce warnings emitted by javac #5

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1696076 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2015-08-15 17:48:37 +00:00
parent 01a568abbb
commit e0d6e53756
5 changed files with 7 additions and 4 deletions

View File

@ -250,7 +250,7 @@ public class LineDocSource extends ContentSource {
try { try {
final Class<? extends LineParser> clazz = final Class<? extends LineParser> clazz =
Class.forName(docDataLineReaderClassName).asSubclass(LineParser.class); Class.forName(docDataLineReaderClassName).asSubclass(LineParser.class);
Constructor<? extends LineParser> cnstr = clazz.getConstructor(new Class[]{String[].class}); Constructor<? extends LineParser> cnstr = clazz.getConstructor(String[].class);
return cnstr.newInstance((Object)header); return cnstr.newInstance((Object)header);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("Failed to instantiate "+docDataLineReaderClassName, e); throw new RuntimeException("Failed to instantiate "+docDataLineReaderClassName, e);

View File

@ -112,6 +112,7 @@ public class AnalyzerFactoryTask extends PerfTask {
* and 0+ TokenFilterFactory's * and 0+ TokenFilterFactory's
*/ */
@Override @Override
@SuppressWarnings("fallthrough")
public void setParams(String params) { public void setParams(String params) {
super.setParams(params); super.setParams(params);
ArgType expectedArgType = ArgType.ANALYZER_ARG; 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 stok stream tokenizer from which to draw analysis factory params
* @param clazz analysis factory class to instantiate * @param clazz analysis factory class to instantiate
*/ */
@SuppressWarnings("fallthrough")
private void createAnalysisPipelineComponent private void createAnalysisPipelineComponent
(StreamTokenizer stok, Class<? extends AbstractAnalysisFactory> clazz) { (StreamTokenizer stok, Class<? extends AbstractAnalysisFactory> clazz) {
Map<String,String> argMap = new HashMap<>(); Map<String,String> argMap = new HashMap<>();

View File

@ -65,8 +65,7 @@ public class NewCollationAnalyzerTask extends PerfTask {
static Analyzer createAnalyzer(Locale locale, Implementation impl) static Analyzer createAnalyzer(Locale locale, Implementation impl)
throws Exception { throws Exception {
final Class<?> collatorClazz = Class.forName(impl.collatorClassName); final Class<?> collatorClazz = Class.forName(impl.collatorClassName);
Method collatorMethod = collatorClazz.getMethod("getInstance", Method collatorMethod = collatorClazz.getMethod("getInstance", Locale.class);
new Class[] {Locale.class});
Object collator = collatorMethod.invoke(null, locale); Object collator = collatorMethod.invoke(null, locale);
final Class<? extends Analyzer> clazz = Class.forName(impl.className) final Class<? extends Analyzer> clazz = Class.forName(impl.className)

View File

@ -751,7 +751,7 @@ public final class MoreLikeThis {
private PriorityQueue<ScoreTerm> retrieveTerms(Map<String, Collection<Object>> fields) throws private PriorityQueue<ScoreTerm> retrieveTerms(Map<String, Collection<Object>> fields) throws
IOException { IOException {
HashMap<String,Int> termFreqMap = new HashMap(); HashMap<String,Int> termFreqMap = new HashMap<>();
for (String fieldName : fieldNames) { for (String fieldName : fieldNames) {
for (String field : fields.keySet()) { for (String field : fields.keySet()) {
Collection<Object> fieldValues = fields.get(field); Collection<Object> fieldValues = fields.get(field);

View File

@ -44,6 +44,7 @@ import com.carrotsearch.randomizedtesting.generators.RandomInts;
public class TestDocValuesFieldSources extends LuceneTestCase { public class TestDocValuesFieldSources extends LuceneTestCase {
@SuppressWarnings("fallthrough")
public void test(DocValuesType type) throws IOException { public void test(DocValuesType type) throws IOException {
Directory d = newDirectory(); Directory d = newDirectory();
IndexWriterConfig iwConfig = newIndexWriterConfig(new MockAnalyzer(random())); IndexWriterConfig iwConfig = newIndexWriterConfig(new MockAnalyzer(random()));
@ -126,6 +127,7 @@ public class TestDocValuesFieldSources extends LuceneTestCase {
case SORTED: case SORTED:
values.ordVal(i); // no exception values.ordVal(i); // no exception
assertTrue(values.numOrd() >= 1); assertTrue(values.numOrd() >= 1);
// fall-through
case BINARY: case BINARY:
assertEquals(expected, values.objectVal(i)); assertEquals(expected, values.objectVal(i));
assertEquals(expected, values.strVal(i)); assertEquals(expected, values.strVal(i));