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 {
final Class<? extends LineParser> clazz =
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);
} catch (Exception e) {
throw new RuntimeException("Failed to instantiate "+docDataLineReaderClassName, e);

View File

@ -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<? extends AbstractAnalysisFactory> clazz) {
Map<String,String> argMap = new HashMap<>();

View File

@ -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<? 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
IOException {
HashMap<String,Int> termFreqMap = new HashMap();
HashMap<String,Int> termFreqMap = new HashMap<>();
for (String fieldName : fieldNames) {
for (String field : fields.keySet()) {
Collection<Object> fieldValues = fields.get(field);

View File

@ -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));