Add xlint ignores for warning classes, where appropriate.

This commit is contained in:
Ryan Ernst 2015-09-09 12:47:07 -07:00
parent b04160d9f5
commit 9e8a90a657
18 changed files with 33 additions and 21 deletions

View File

@ -15,6 +15,10 @@
<name>Elasticsearch: Core</name>
<description>Elasticsearch - Open Source, Distributed, RESTful Search Engine</description>
<properties>
<xlint.options>-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked</xlint.options>
</properties>
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>

View File

@ -308,7 +308,6 @@ public class MinDocCountIT extends AbstractTermsTestCase {
logger.error("exception on retry (will re-throw the original in a sec)", secondFailure);
}
throw ae;
}
}

View File

@ -1713,7 +1713,9 @@ public abstract class ESIntegTestCase extends ESTestCase {
}
/** Helper method to create list of plugins without specifying generic types. */
protected static Collection<Class<? extends Plugin>> pluginList(Class<? extends Plugin>... plugins) {
@SafeVarargs
@SuppressWarnings("varargs") // due to type erasure, the varargs type is non-reifiable, which casues this warning
protected final Collection<Class<? extends Plugin>> pluginList(Class<? extends Plugin>... plugins) {
return Arrays.asList(plugins);
}

View File

@ -18,6 +18,7 @@
<elasticsearch.plugin.classname>org.elasticsearch.plugin.analysis.icu.AnalysisICUPlugin</elasticsearch.plugin.classname>
<tests.rest.suite>analysis_icu</tests.rest.suite>
<tests.rest.load_packaged>false</tests.rest.load_packaged>
<xlint.options>-Xlint:-deprecation</xlint.options>
</properties>
<dependencies>

View File

@ -18,6 +18,7 @@
<elasticsearch.plugin.classname>org.elasticsearch.plugin.analysis.AnalysisPhoneticPlugin</elasticsearch.plugin.classname>
<tests.rest.suite>analysis_phonetic</tests.rest.suite>
<tests.rest.load_packaged>false</tests.rest.load_packaged>
<xlint.options>-Xlint:-rawtypes,-unchecked</xlint.options>
</properties>
<dependencies>

View File

@ -30,6 +30,8 @@ governing permissions and limitations under the License. -->
<tests.jvms>1</tests.jvms>
<tests.rest.suite>cloud_azure</tests.rest.suite>
<tests.rest.load_packaged>false</tests.rest.load_packaged>
<!-- need -path because there is no resources dir... -->
<xlint.options>-Xlint:-path,-serial,-static,-unchecked</xlint.options>
</properties>
<dependencies>

View File

@ -31,6 +31,7 @@ governing permissions and limitations under the License. -->
<!-- currently has no unit tests -->
<tests.rest.suite>cloud_gce</tests.rest.suite>
<tests.rest.load_packaged>false</tests.rest.load_packaged>
<xlint.options>-Xlint:-rawtypes,-unchecked</xlint.options>
</properties>
<dependencies>

View File

@ -113,7 +113,7 @@ public class DeleteByQueryRequest extends ActionRequest<DeleteByQueryRequest> im
}
@Override
public DeleteByQueryRequest indices(String... indices) {
public DeleteByQueryRequest indices(String[] indices) {
this.indices = indices;
return this;
}
@ -149,7 +149,7 @@ public class DeleteByQueryRequest extends ActionRequest<DeleteByQueryRequest> im
return this;
}
public DeleteByQueryRequest source(Map querySource) {
public DeleteByQueryRequest source(Map<String,?> querySource) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(Requests.CONTENT_TYPE);
builder.map(querySource);

View File

@ -48,7 +48,7 @@ public class TransportDeleteByQueryActionTests extends ESSingleNodeTestCase {
@Test
public void testExecuteScanFailsOnMissingIndex() {
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices("none");
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices(new String[]{"none"});
TestActionListener listener = new TestActionListener();
newAsyncAction(delete, listener).executeScan();
@ -62,7 +62,7 @@ public class TransportDeleteByQueryActionTests extends ESSingleNodeTestCase {
public void testExecuteScanFailsOnMalformedQuery() {
createIndex("test");
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices("test").source("{...}");
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices(new String[]{"test"}).source("{...}");
TestActionListener listener = new TestActionListener();
newAsyncAction(delete, listener).executeScan();
@ -83,7 +83,7 @@ public class TransportDeleteByQueryActionTests extends ESSingleNodeTestCase {
assertHitCount(client().prepareCount("test").get(), numDocs);
final long limit = randomIntBetween(0, numDocs);
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices("test").source(boolQuery().must(rangeQuery("num").lte(limit)).buildAsBytes());
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices(new String[]{"test"}).source(boolQuery().must(rangeQuery("num").lte(limit)).buildAsBytes());
TestActionListener listener = new TestActionListener();
newAsyncAction(delete, listener).executeScan();
@ -139,7 +139,7 @@ public class TransportDeleteByQueryActionTests extends ESSingleNodeTestCase {
ClearScrollResponse clearScrollResponse = client().prepareClearScroll().addScrollId(scrollId).get();
assertTrue(clearScrollResponse.isSucceeded());
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices("test");
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices(new String[]{"test"});
TestActionListener listener = new TestActionListener();
newAsyncAction(delete, listener).executeScroll(searchResponse.getScrollId());
@ -160,7 +160,7 @@ public class TransportDeleteByQueryActionTests extends ESSingleNodeTestCase {
String scrollId = searchResponse.getScrollId();
assertTrue(Strings.hasText(scrollId));
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices("test").timeout(TimeValue.timeValueSeconds(1));
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices(new String[]{"test"}).timeout(TimeValue.timeValueSeconds(1));
TestActionListener listener = new TestActionListener();
final TransportDeleteByQueryAction.AsyncDeleteByQueryAction async = newAsyncAction(delete, listener);
@ -183,7 +183,7 @@ public class TransportDeleteByQueryActionTests extends ESSingleNodeTestCase {
String scrollId = searchResponse.getScrollId();
assertTrue(Strings.hasText(scrollId));
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices("test");
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices(new String[]{"test"});
TestActionListener listener = new TestActionListener();
newAsyncAction(delete, listener).executeScroll(searchResponse.getScrollId());
@ -219,7 +219,7 @@ public class TransportDeleteByQueryActionTests extends ESSingleNodeTestCase {
assertTrue(Strings.hasText(scrollId));
assertThat(searchResponse.getHits().getTotalHits(), equalTo(limit));
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices("test").size(100).source(boolQuery().must(rangeQuery("num").lte(limit)).buildAsBytes());
DeleteByQueryRequest delete = new DeleteByQueryRequest().indices(new String[]{"test"}).size(100).source(boolQuery().must(rangeQuery("num").lte(limit)).buildAsBytes());
TestActionListener listener = new TestActionListener();
newAsyncAction(delete, listener).executeScroll(searchResponse.getScrollId());

View File

@ -20,6 +20,7 @@
<tests.jvms>1</tests.jvms>
<tests.rest.suite>discovery_ec2</tests.rest.suite>
<tests.rest.load_packaged>false</tests.rest.load_packaged>
<xlint.options>-Xlint:-rawtypes</xlint.options>
</properties>
<dependencies>

View File

@ -79,7 +79,7 @@ public class AwsEc2UnicastHostsProvider extends AbstractComponent implements Uni
this.tags = settings.getByPrefix("discovery.ec2.tag.").getAsMap();
Set<String> availabilityZones = new HashSet();
Set<String> availabilityZones = new HashSet<>();
availabilityZones.addAll(Arrays.asList(settings.getAsArray("discovery.ec2.availability_zones")));
if (settings.get("discovery.ec2.availability_zones") != null) {
availabilityZones.addAll(Strings.commaDelimitedListToSet(settings.get("discovery.ec2.availability_zones")));

View File

@ -19,6 +19,7 @@
<tests.rest.suite>jvm_example</tests.rest.suite>
<tests.rest.load_packaged>false</tests.rest.load_packaged>
<skip.unit.tests>true</skip.unit.tests>
<xlint.options>-Xlint:-rawtypes</xlint.options>
</properties>
<build>

View File

@ -18,6 +18,7 @@
<elasticsearch.plugin.classname>org.elasticsearch.plugin.javascript.JavaScriptPlugin</elasticsearch.plugin.classname>
<tests.rest.suite>lang_javascript</tests.rest.suite>
<tests.rest.load_packaged>false</tests.rest.load_packaged>
<xlint.options>-Xlint:-rawtypes,-unchecked</xlint.options>
</properties>
<dependencies>

View File

@ -18,6 +18,7 @@
<elasticsearch.plugin.classname>org.elasticsearch.plugin.python.PythonPlugin</elasticsearch.plugin.classname>
<tests.rest.suite>lang_python</tests.rest.suite>
<tests.rest.load_packaged>false</tests.rest.load_packaged>
<xlint.options>-Xlint:-unchecked</xlint.options>
</properties>
<dependencies>

View File

@ -29,6 +29,7 @@ governing permissions and limitations under the License. -->
<elasticsearch.plugin.classname>org.elasticsearch.plugin.mapper.MapperMurmur3Plugin</elasticsearch.plugin.classname>
<tests.rest.suite>mapper_murmur3</tests.rest.suite>
<tests.rest.load_packaged>false</tests.rest.load_packaged>
<xlint.options>-Xlint:-rawtypes</xlint.options>
</properties>
<build>

View File

@ -20,6 +20,7 @@
<tests.jvms>1</tests.jvms>
<tests.rest.suite>repository_s3</tests.rest.suite>
<tests.rest.load_packaged>false</tests.rest.load_packaged>
<xlint.options>-Xlint:-rawtypes</xlint.options>
</properties>
<dependencies>

View File

@ -38,7 +38,7 @@ public class TestAwsS3Service extends InternalAwsS3Service {
return "plugs in mock s3 service";
}
public void onModule(S3Module s3Module) {
s3Module.s3ServiceImpl = TestAwsS3Service.class;
S3Module.s3ServiceImpl = TestAwsS3Service.class;
}
}

12
pom.xml
View File

@ -39,6 +39,9 @@
<jvm.executable>${java.home}${file.separator}bin${file.separator}java</jvm.executable>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- Path warnings must be ignored because maven doesnt create the classes output
dir when no source files exist (eg for distribution or qa modules) -->
<xlint.options>-Xlint:-path</xlint.options>
<!-- libraries -->
<lucene.version>5.4.0</lucene.version>
@ -578,14 +581,7 @@
<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>${xlint.options}</arg>
<arg>-Werror</arg>
</compilerArgs>
</configuration>