Remove Xlint from lang-groovy and discovery-azure
discovery-azure didn't actually need it. This removes all non-default Xlints from modules.
This commit is contained in:
parent
63090f5d4b
commit
bd1324ccc9
|
@ -26,9 +26,6 @@ dependencies {
|
||||||
compile 'org.codehaus.groovy:groovy:2.4.4:indy'
|
compile 'org.codehaus.groovy:groovy:2.4.4:indy'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.options.compilerArgs << '-Xlint:-rawtypes,-unchecked,-cast'
|
|
||||||
compileTestJava.options.compilerArgs << '-Xlint:-rawtypes,-unchecked,-cast'
|
|
||||||
|
|
||||||
integTest {
|
integTest {
|
||||||
cluster {
|
cluster {
|
||||||
systemProperty 'es.script.inline', 'on'
|
systemProperty 'es.script.inline', 'on'
|
||||||
|
|
|
@ -23,6 +23,7 @@ import groovy.lang.Binding;
|
||||||
import groovy.lang.GroovyClassLoader;
|
import groovy.lang.GroovyClassLoader;
|
||||||
import groovy.lang.GroovyCodeSource;
|
import groovy.lang.GroovyCodeSource;
|
||||||
import groovy.lang.Script;
|
import groovy.lang.Script;
|
||||||
|
|
||||||
import org.apache.lucene.index.LeafReaderContext;
|
import org.apache.lucene.index.LeafReaderContext;
|
||||||
import org.apache.lucene.search.Scorer;
|
import org.apache.lucene.search.Scorer;
|
||||||
import org.codehaus.groovy.ast.ClassCodeExpressionTransformer;
|
import org.codehaus.groovy.ast.ClassCodeExpressionTransformer;
|
||||||
|
@ -182,6 +183,7 @@ public class GroovyScriptEngineService extends AbstractComponent implements Scri
|
||||||
String fake = MessageDigests.toHexString(MessageDigests.sha1().digest(script.getBytes(StandardCharsets.UTF_8)));
|
String fake = MessageDigests.toHexString(MessageDigests.sha1().digest(script.getBytes(StandardCharsets.UTF_8)));
|
||||||
// same logic as GroovyClassLoader.parseClass() but with a different codesource string:
|
// same logic as GroovyClassLoader.parseClass() but with a different codesource string:
|
||||||
return AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
return AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||||
|
@Override
|
||||||
public Class<?> run() {
|
public Class<?> run() {
|
||||||
GroovyCodeSource gcs = new GroovyCodeSource(script, fake, BootstrapInfo.UNTRUSTED_CODEBASE);
|
GroovyCodeSource gcs = new GroovyCodeSource(script, fake, BootstrapInfo.UNTRUSTED_CODEBASE);
|
||||||
gcs.setCachable(false);
|
gcs.setCachable(false);
|
||||||
|
@ -203,7 +205,7 @@ public class GroovyScriptEngineService extends AbstractComponent implements Scri
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private Script createScript(Object compiledScript, Map<String, Object> vars) throws InstantiationException, IllegalAccessException {
|
private Script createScript(Object compiledScript, Map<String, Object> vars) throws InstantiationException, IllegalAccessException {
|
||||||
Class scriptClass = (Class) compiledScript;
|
Class<?> scriptClass = (Class<?>) compiledScript;
|
||||||
Script scriptObject = (Script) scriptClass.newInstance();
|
Script scriptObject = (Script) scriptClass.newInstance();
|
||||||
Binding binding = new Binding();
|
Binding binding = new Binding();
|
||||||
binding.getVariables().putAll(vars);
|
binding.getVariables().putAll(vars);
|
||||||
|
@ -211,7 +213,6 @@ public class GroovyScriptEngineService extends AbstractComponent implements Scri
|
||||||
return scriptObject;
|
return scriptObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
|
||||||
@Override
|
@Override
|
||||||
public ExecutableScript executable(CompiledScript compiledScript, Map<String, Object> vars) {
|
public ExecutableScript executable(CompiledScript compiledScript, Map<String, Object> vars) {
|
||||||
try {
|
try {
|
||||||
|
@ -225,7 +226,6 @@ public class GroovyScriptEngineService extends AbstractComponent implements Scri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
|
||||||
@Override
|
@Override
|
||||||
public SearchScript search(final CompiledScript compiledScript, final SearchLookup lookup, @Nullable final Map<String, Object> vars) {
|
public SearchScript search(final CompiledScript compiledScript, final SearchLookup lookup, @Nullable final Map<String, Object> vars) {
|
||||||
return new SearchScript() {
|
return new SearchScript() {
|
||||||
|
@ -288,7 +288,6 @@ public class GroovyScriptEngineService extends AbstractComponent implements Scri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
|
||||||
@Override
|
@Override
|
||||||
public void setNextVar(String name, Object value) {
|
public void setNextVar(String name, Object value) {
|
||||||
variables.put(name, value);
|
variables.put(name, value);
|
||||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.messy.tests;
|
||||||
import com.carrotsearch.hppc.LongHashSet;
|
import com.carrotsearch.hppc.LongHashSet;
|
||||||
import com.carrotsearch.hppc.LongSet;
|
import com.carrotsearch.hppc.LongSet;
|
||||||
import com.carrotsearch.randomizedtesting.generators.RandomStrings;
|
import com.carrotsearch.randomizedtesting.generators.RandomStrings;
|
||||||
|
|
||||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||||
import org.elasticsearch.action.search.SearchRequest;
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
import org.elasticsearch.action.search.SearchResponse;
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
|
@ -65,7 +66,7 @@ public class MinDocCountTests extends AbstractTermsTestCase {
|
||||||
return Collections.singleton(GroovyPlugin.class);
|
return Collections.singleton(GroovyPlugin.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final QueryBuilder QUERY = QueryBuilders.termQuery("match", true);
|
private static final QueryBuilder<?> QUERY = QueryBuilders.termQuery("match", true);
|
||||||
|
|
||||||
private static int cardinality;
|
private static int cardinality;
|
||||||
|
|
||||||
|
@ -77,7 +78,6 @@ public class MinDocCountTests extends AbstractTermsTestCase {
|
||||||
final List<IndexRequestBuilder> indexRequests = new ArrayList<>();
|
final List<IndexRequestBuilder> indexRequests = new ArrayList<>();
|
||||||
final Set<String> stringTerms = new HashSet<>();
|
final Set<String> stringTerms = new HashSet<>();
|
||||||
final LongSet longTerms = new LongHashSet();
|
final LongSet longTerms = new LongHashSet();
|
||||||
final Set<String> dateTerms = new HashSet<>();
|
|
||||||
for (int i = 0; i < cardinality; ++i) {
|
for (int i = 0; i < cardinality; ++i) {
|
||||||
String stringTerm;
|
String stringTerm;
|
||||||
do {
|
do {
|
||||||
|
@ -319,7 +319,6 @@ public class MinDocCountTests extends AbstractTermsTestCase {
|
||||||
throw ae;
|
throw ae;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHistogramCountAsc() throws Exception {
|
public void testHistogramCountAsc() throws Exception {
|
||||||
|
@ -372,11 +371,9 @@ public class MinDocCountTests extends AbstractTermsTestCase {
|
||||||
.execute().actionGet();
|
.execute().actionGet();
|
||||||
assertSubset(allHisto, (Histogram) response.getAggregations().get("histo"), minDocCount);
|
assertSubset(allHisto, (Histogram) response.getAggregations().get("histo"), minDocCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testMinDocCountOnDateHistogram(Histogram.Order order) throws Exception {
|
private void testMinDocCountOnDateHistogram(Histogram.Order order) throws Exception {
|
||||||
final int interval = randomIntBetween(1, 3);
|
|
||||||
final SearchResponse allResponse = client().prepareSearch("idx").setTypes("type")
|
final SearchResponse allResponse = client().prepareSearch("idx").setTypes("type")
|
||||||
.setSize(0)
|
.setSize(0)
|
||||||
.setQuery(QUERY)
|
.setQuery(QUERY)
|
||||||
|
@ -393,7 +390,5 @@ public class MinDocCountTests extends AbstractTermsTestCase {
|
||||||
.execute().actionGet();
|
.execute().actionGet();
|
||||||
assertSubset(allHisto, (Histogram) response.getAggregations().get("histo"), minDocCount);
|
assertSubset(allHisto, (Histogram) response.getAggregations().get("histo"), minDocCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class ScriptedMetricTests extends ESIntegTestCase {
|
||||||
for (Object object : aggregationList) {
|
for (Object object : aggregationList) {
|
||||||
assertThat(object, notNullValue());
|
assertThat(object, notNullValue());
|
||||||
assertThat(object, instanceOf(Map.class));
|
assertThat(object, instanceOf(Map.class));
|
||||||
Map<String, Object> map = (Map<String, Object>) object;
|
Map<?, ?> map = (Map<?, ?>) object;
|
||||||
assertThat(map.size(), lessThanOrEqualTo(1));
|
assertThat(map.size(), lessThanOrEqualTo(1));
|
||||||
if (map.size() == 1) {
|
if (map.size() == 1) {
|
||||||
assertThat(map.get("count"), notNullValue());
|
assertThat(map.get("count"), notNullValue());
|
||||||
|
@ -740,6 +740,7 @@ public class ScriptedMetricTests extends ESIntegTestCase {
|
||||||
assertThat(scriptedMetric.getName(), equalTo("scripted"));
|
assertThat(scriptedMetric.getName(), equalTo("scripted"));
|
||||||
assertThat(scriptedMetric.aggregation(), notNullValue());
|
assertThat(scriptedMetric.aggregation(), notNullValue());
|
||||||
assertThat(scriptedMetric.aggregation(), instanceOf(List.class));
|
assertThat(scriptedMetric.aggregation(), instanceOf(List.class));
|
||||||
|
@SuppressWarnings("unchecked") // We'll just get a ClassCastException a couple lines down if we're wrong, its ok.
|
||||||
List<Integer> aggregationResult = (List<Integer>) scriptedMetric.aggregation();
|
List<Integer> aggregationResult = (List<Integer>) scriptedMetric.aggregation();
|
||||||
assertThat(aggregationResult.size(), equalTo(1));
|
assertThat(aggregationResult.size(), equalTo(1));
|
||||||
assertThat(aggregationResult.get(0), equalTo(0));
|
assertThat(aggregationResult.get(0), equalTo(0));
|
||||||
|
|
|
@ -339,9 +339,7 @@ public class SearchFieldsTests extends ESIntegTestCase {
|
||||||
.execute().actionGet();
|
.execute().actionGet();
|
||||||
client().admin().indices().refresh(refreshRequest()).actionGet();
|
client().admin().indices().refresh(refreshRequest()).actionGet();
|
||||||
|
|
||||||
SearchResponse response = client().prepareSearch()
|
SearchResponse response = client().prepareSearch().setQuery(matchAllQuery()).addScriptField("s_obj1", new Script("_source.obj1"))
|
||||||
.setQuery(matchAllQuery())
|
|
||||||
.addScriptField("s_obj1", new Script("_source.obj1"))
|
|
||||||
.addScriptField("s_obj1_test", new Script("_source.obj1.test")).addScriptField("s_obj2", new Script("_source.obj2"))
|
.addScriptField("s_obj1_test", new Script("_source.obj1.test")).addScriptField("s_obj2", new Script("_source.obj2"))
|
||||||
.addScriptField("s_obj2_arr2", new Script("_source.obj2.arr2")).addScriptField("s_arr3", new Script("_source.arr3"))
|
.addScriptField("s_obj2_arr2", new Script("_source.obj2.arr2")).addScriptField("s_arr3", new Script("_source.arr3"))
|
||||||
.execute().actionGet();
|
.execute().actionGet();
|
||||||
|
@ -355,7 +353,7 @@ public class SearchFieldsTests extends ESIntegTestCase {
|
||||||
assertThat(response.getHits().getAt(0).field("s_obj1_test").value().toString(), equalTo("something"));
|
assertThat(response.getHits().getAt(0).field("s_obj1_test").value().toString(), equalTo("something"));
|
||||||
|
|
||||||
Map<String, Object> sObj2 = response.getHits().getAt(0).field("s_obj2").value();
|
Map<String, Object> sObj2 = response.getHits().getAt(0).field("s_obj2").value();
|
||||||
List sObj2Arr2 = (List) sObj2.get("arr2");
|
List<?> sObj2Arr2 = (List<?>) sObj2.get("arr2");
|
||||||
assertThat(sObj2Arr2.size(), equalTo(2));
|
assertThat(sObj2Arr2.size(), equalTo(2));
|
||||||
assertThat(sObj2Arr2.get(0).toString(), equalTo("arr_value1"));
|
assertThat(sObj2Arr2.get(0).toString(), equalTo("arr_value1"));
|
||||||
assertThat(sObj2Arr2.get(1).toString(), equalTo("arr_value2"));
|
assertThat(sObj2Arr2.get(1).toString(), equalTo("arr_value2"));
|
||||||
|
@ -365,8 +363,8 @@ public class SearchFieldsTests extends ESIntegTestCase {
|
||||||
assertThat(sObj2Arr2.get(0).toString(), equalTo("arr_value1"));
|
assertThat(sObj2Arr2.get(0).toString(), equalTo("arr_value1"));
|
||||||
assertThat(sObj2Arr2.get(1).toString(), equalTo("arr_value2"));
|
assertThat(sObj2Arr2.get(1).toString(), equalTo("arr_value2"));
|
||||||
|
|
||||||
List sObj2Arr3 = response.getHits().getAt(0).field("s_arr3").values();
|
List<?> sObj2Arr3 = response.getHits().getAt(0).field("s_arr3").values();
|
||||||
assertThat(((Map) sObj2Arr3.get(0)).get("arr3_field1").toString(), equalTo("arr3_value1"));
|
assertThat(((Map<?, ?>) sObj2Arr3.get(0)).get("arr3_field1").toString(), equalTo("arr3_value1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPartialFields() throws Exception {
|
public void testPartialFields() throws Exception {
|
||||||
|
|
|
@ -56,8 +56,6 @@ dependencyLicenses {
|
||||||
mapping from: /jaxb-.*/, to: 'jaxb'
|
mapping from: /jaxb-.*/, to: 'jaxb'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.options.compilerArgs << '-Xlint:-path,-unchecked'
|
|
||||||
|
|
||||||
thirdPartyAudit.excludes = [
|
thirdPartyAudit.excludes = [
|
||||||
// classes are missing
|
// classes are missing
|
||||||
'javax.servlet.ServletContextEvent',
|
'javax.servlet.ServletContextEvent',
|
||||||
|
|
Loading…
Reference in New Issue