Add Xlint options and fix some warnings
This commit is contained in:
parent
2d15cab68c
commit
b04160d9f5
|
@ -668,6 +668,7 @@ public class IndexNameExpressionResolver extends AbstractComponent {
|
|||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("fallthrough")
|
||||
String resolveExpression(String expression, final Context context) {
|
||||
if (expression.startsWith(EXPRESSION_LEFT_BOUND) == false || expression.endsWith(EXPRESSION_RIGHT_BOUND) == false) {
|
||||
return expression;
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.common.inject.TypeLiteral;
|
|||
* @param <I> the injectable type encountered
|
||||
* @since 2.0
|
||||
*/
|
||||
@SuppressWarnings("overloads")
|
||||
public interface TypeEncounter<I> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -71,7 +71,7 @@ public class NodeEnvironment extends AbstractComponent implements Closeable {
|
|||
public NodePath(Path path, Environment environment) throws IOException {
|
||||
this.path = path;
|
||||
this.indicesPath = path.resolve(INDICES_FOLDER);
|
||||
this.fileStore = environment.getFileStore(path);
|
||||
this.fileStore = Environment.getFileStore(path);
|
||||
if (fileStore.supportsFileAttributeView("lucene")) {
|
||||
this.spins = (Boolean) fileStore.getAttribute("lucene:spins");
|
||||
} else {
|
||||
|
|
|
@ -59,6 +59,7 @@ public class SingleFieldsVisitor extends FieldsVisitor {
|
|||
|
||||
public void postProcess(MappedFieldType fieldType) {
|
||||
if (uid != null) {
|
||||
// TODO: this switch seems very wrong...either each case should be breaking, or this should not be a switch
|
||||
switch (field) {
|
||||
case UidFieldMapper.NAME: addValue(field, uid.toString());
|
||||
case IdFieldMapper.NAME: addValue(field, uid.id());
|
||||
|
|
|
@ -227,6 +227,7 @@ public class QueryPhase implements SearchPhase {
|
|||
// set the last emitted doc
|
||||
scrollContext.lastEmittedDoc = topDocs.scoreDocs[topDocs.scoreDocs.length - 1];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -390,7 +390,7 @@ public class TranslogTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testSnapshotOnClosedTranslog() throws IOException {
|
||||
assertTrue(Files.exists(translogDir.resolve(translog.getFilename(1))));
|
||||
assertTrue(Files.exists(translogDir.resolve(Translog.getFilename(1))));
|
||||
translog.add(new Translog.Create("test", "1", new byte[]{1}));
|
||||
translog.close();
|
||||
try {
|
||||
|
@ -436,14 +436,14 @@ public class TranslogTests extends ESTestCase {
|
|||
|
||||
|
||||
public void assertFileIsPresent(Translog translog, long id) {
|
||||
if (Files.exists(translogDir.resolve(translog.getFilename(id)))) {
|
||||
if (Files.exists(translogDir.resolve(Translog.getFilename(id)))) {
|
||||
return;
|
||||
}
|
||||
fail(translog.getFilename(id) + " is not present in any location: " + translog.location());
|
||||
fail(Translog.getFilename(id) + " is not present in any location: " + translog.location());
|
||||
}
|
||||
|
||||
public void assertFileDeleted(Translog translog, long id) {
|
||||
assertFalse("translog [" + id + "] still exists", Files.exists(translog.location().resolve(translog.getFilename(id))));
|
||||
assertFalse("translog [" + id + "] still exists", Files.exists(translog.location().resolve(Translog.getFilename(id))));
|
||||
}
|
||||
|
||||
static class LocationOperation {
|
||||
|
@ -913,7 +913,7 @@ public class TranslogTests extends ESTestCase {
|
|||
final Translog.Location lastLocation = translog.add(new Translog.Create("test", "" + translogOperations, Integer.toString(translogOperations).getBytes(Charset.forName("UTF-8"))));
|
||||
|
||||
final Checkpoint checkpoint = Checkpoint.read(translog.location().resolve(Translog.CHECKPOINT_FILE_NAME));
|
||||
try (final ImmutableTranslogReader reader = translog.openReader(translog.location().resolve(translog.getFilename(translog.currentFileGeneration())), checkpoint)) {
|
||||
try (final ImmutableTranslogReader reader = translog.openReader(translog.location().resolve(Translog.getFilename(translog.currentFileGeneration())), checkpoint)) {
|
||||
assertEquals(lastSynced + 1, reader.totalOperations());
|
||||
for (int op = 0; op < translogOperations; op++) {
|
||||
Translog.Location location = locations.get(op);
|
||||
|
|
|
@ -306,9 +306,9 @@ public class MinDocCountIT extends AbstractTermsTestCase {
|
|||
testMinDocCountOnTerms(field, script, order, include, false);
|
||||
} catch (Throwable secondFailure) {
|
||||
logger.error("exception on retry (will re-throw the original in a sec)", secondFailure);
|
||||
} finally {
|
||||
throw ae;
|
||||
}
|
||||
throw ae;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
10
pom.xml
10
pom.xml
|
@ -574,8 +574,18 @@
|
|||
be fixed in version > 3.1
|
||||
-->
|
||||
<useIncrementalCompilation>false</useIncrementalCompilation>
|
||||
<showWarnings>true</showWarnings>
|
||||
<compilerArgs>
|
||||
<arg>-XDignore.symbol.file</arg>
|
||||
<arg>-Xlint:all</arg>
|
||||
<arg>-Xlint:-cast</arg>
|
||||
<arg>-Xlint:-deprecation</arg>
|
||||
<arg>-Xlint:-fallthrough</arg>
|
||||
<arg>-Xlint:-overrides</arg>
|
||||
<arg>-Xlint:-rawtypes</arg>
|
||||
<arg>-Xlint:-serial</arg>
|
||||
<arg>-Xlint:-try</arg>
|
||||
<arg>-Xlint:-unchecked</arg>
|
||||
<arg>-Werror</arg>
|
||||
</compilerArgs>
|
||||
</configuration>
|
||||
|
|
Loading…
Reference in New Issue