Skip to content

Commit d6722e7

Browse files
committed
Encore consistent compile options across all projects (#54120)
(cherry picked from commit ddd068a)
1 parent e1e2fda commit d6722e7

File tree

9 files changed

+17
-21
lines changed

9 files changed

+17
-21
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/StandaloneRestTestPlugin.groovy

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@ import org.gradle.api.InvalidUserDataException
3232
import org.gradle.api.Plugin
3333
import org.gradle.api.Project
3434
import org.gradle.api.artifacts.Configuration
35-
import org.gradle.api.plugins.ExtraPropertiesExtension
3635
import org.gradle.api.plugins.JavaBasePlugin
3736
import org.gradle.api.plugins.JavaPlugin
3837
import org.gradle.api.plugins.JavaPluginExtension
3938
import org.gradle.api.tasks.SourceSet
4039
import org.gradle.api.tasks.SourceSetContainer
41-
import org.gradle.api.tasks.compile.JavaCompile
4240
import org.gradle.api.tasks.testing.Test
4341
import org.gradle.plugins.ide.eclipse.model.EclipseModel
4442
import org.gradle.plugins.ide.idea.model.IdeaModel
@@ -67,8 +65,8 @@ class StandaloneRestTestPlugin implements Plugin<Project> {
6765
BuildPlugin.configureTestTasks(project)
6866
BuildPlugin.configureInputNormalization(project)
6967
BuildPlugin.configureFips140(project)
68+
BuildPlugin.configureCompile(project)
7069

71-
ExtraPropertiesExtension ext = project.extensions.getByType(ExtraPropertiesExtension)
7270
project.extensions.getByType(JavaPluginExtension).sourceCompatibility = BuildParams.minimumRuntimeVersion
7371
project.extensions.getByType(JavaPluginExtension).targetCompatibility = BuildParams.minimumRuntimeVersion
7472

@@ -96,13 +94,6 @@ class StandaloneRestTestPlugin implements Plugin<Project> {
9694
idea.module.scopes.put('TEST', [plus: [project.configurations.getByName(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME)]] as Map<String, Collection<Configuration>>)
9795

9896
PrecommitTasks.create(project, false)
99-
project.tasks.getByName('check').dependsOn(project.tasks.getByName('precommit'))
100-
101-
project.tasks.withType(JavaCompile) { JavaCompile task ->
102-
// This will be the default in Gradle 5.0
103-
if (task.options.compilerArgs.contains("-processor") == false) {
104-
task.options.compilerArgs << '-proc:none'
105-
}
106-
}
97+
project.tasks.named('check').configure { it.dependsOn(project.tasks.named('precommit')) }
10798
}
10899
}

plugins/discovery-gce/qa/gce/src/test/java/org/elasticsearch/cloud/gce/GCEFixture.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private PathTrie<RequestHandler> defaultHandlers() {
129129
// https://cloud.google.com/compute/docs/reference/rest/v1/instances
130130
handlers.insert(authPath(HttpGet.METHOD_NAME, "/compute/v1/projects/{project}/zones/{zone}/instances"),
131131
request -> {
132-
final List items = new ArrayList();
132+
final List<Map<String, Object>> items = new ArrayList<>();
133133
int count = 0;
134134
for (String address : Files.readAllLines(nodes)) {
135135
count++;

x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,7 @@ private void assertHistoryIsPresent(String policyName, String indexName, boolean
14251425
}
14261426

14271427
// This method should be called inside an assertBusy, it has no retry logic of its own
1428+
@SuppressWarnings("unchecked")
14281429
private void assertHistoryIsPresent(String policyName, String indexName, boolean success,
14291430
@Nullable String phase, @Nullable String action, String stepName) throws IOException {
14301431
logger.info("--> checking for history item [{}], [{}], success: [{}], phase: [{}], action: [{}], step: [{}]",
@@ -1656,6 +1657,7 @@ private void indexDocument() throws IOException {
16561657
logger.info(response.getStatusLine());
16571658
}
16581659

1660+
@SuppressWarnings("unchecked")
16591661
private String getSnapshotState(String snapshot) throws IOException {
16601662
Response response = client().performRequest(new Request("GET", "/_snapshot/repo/" + snapshot));
16611663
Map<String, Object> responseMap;

x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/slm/SnapshotLifecycleRestIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ private Map<String, Object> getSLMStats() {
547547
}
548548

549549
// This method should be called inside an assertBusy, it has no retry logic of its own
550+
@SuppressWarnings("unchecked")
550551
private void assertHistoryIsPresent(String policyName, boolean success, String repository, String operation) throws IOException {
551552
final Request historySearchRequest = new Request("GET", ".slm-history*/_search");
552553
historySearchRequest.setJsonEntity("{\n" +

x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/MlNativeDataFrameAnalyticsIntegTestCase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ protected static void assertMlResultsFieldMappings(String index, String predicte
313313
* - allows dots (".") in the path elements provided as arguments
314314
* - supports implicit casting to the appropriate type
315315
*/
316+
@SuppressWarnings("unchecked")
316317
protected static <T> T getFieldValue(Map<String, Object> doc, String... path) {
317-
return (T)extractValue(String.join(".", path), doc);
318+
return (T) extractValue(String.join(".", path), doc);
318319
}
319320
}

x-pack/plugin/security/qa/tls-basic/src/test/java/org/elasticsearch/xpack/security/TlsWithBasicLicenseIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ private void checkSSLEnabled() throws IOException {
9898
assertThat(ObjectPath.evaluate(usage, "security.ssl.transport.enabled"), equalTo(true));
9999
}
100100

101+
@SuppressWarnings("unchecked")
101102
private void checkCertificateAPI() throws IOException {
102103
Response response = client().performRequest(new Request("GET", "/_ssl/certificates"));
103104
ObjectPath path = ObjectPath.createFromResponse(response);

x-pack/qa/kerberos-tests/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/SpnegoHttpClientConfigCallbackHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private void setupSpnegoAuthSchemeSupport(HttpAsyncClientBuilder httpClientBuild
148148
* returns {@link LoginContext}
149149
*
150150
* @return {@link LoginContext}
151-
* @throws PrivilegedActionException
151+
* @throws PrivilegedActionException if the login triggers a checked exception
152152
*/
153153
public synchronized LoginContext login() throws PrivilegedActionException {
154154
if (this.loginContext == null) {
@@ -181,9 +181,9 @@ public synchronized LoginContext login() throws PrivilegedActionException {
181181
* Subject.doAs
182182
* @param acc the {@link AccessControlContext} to be tied to the specified
183183
* subject and action see
184-
* {@link Subject#doAsPrivileged(Subject, PrivilegedExceptionAction, AccessControlContext)
184+
* {@link Subject#doAsPrivileged(Subject, PrivilegedExceptionAction, AccessControlContext)}
185185
* @return the value returned by the PrivilegedExceptionAction's run method
186-
* @throws PrivilegedActionException
186+
* @throws PrivilegedActionException if the specified action's run method threw a checked exception
187187
*/
188188
static <T> T doAsPrivilegedWrapper(final Subject subject, final PrivilegedExceptionAction<T> action, final AccessControlContext acc)
189189
throws PrivilegedActionException {

x-pack/qa/oidc-op-tests/src/test/java/org/elasticsearch/xpack/security/authc/oidc/OpenIdConnectAuthIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ private Tuple<String, String> completeAuthentication(String redirectUri, String
327327
logger.info(" OpenIDConnect authentication response {}", responseBody);
328328
assertNotNull(responseBody.get("access_token"));
329329
assertNotNull(responseBody.get("refresh_token"));
330-
return new Tuple(responseBody.get("access_token"), responseBody.get("refresh_token"));
330+
return Tuple.tuple(responseBody.get("access_token").toString(), responseBody.get("refresh_token").toString());
331331
}
332332

333333
private Request buildRequest(String method, String endpoint, Map<String, ?> body, Header... headers) throws IOException {

x-pack/qa/saml-idp-tests/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlAuthenticationIT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ private Tuple<String, String> loginViaSaml(String acs) throws Exception {
297297
}
298298

299299
/**
300-
* Verifies that the provided "Access Token" (see {@link org.elasticsearch.xpack.security.authc.TokenService})
300+
* Verifies that the provided "Access Token" (see org.elasticsearch.xpack.security.authc.TokenService)
301301
* is for the expected user with the expected name and roles if the user was created from Role-Mapping
302302
*/
303303
private void verifyElasticsearchAccessTokenForRoleMapping(String accessToken) throws IOException {
@@ -315,7 +315,7 @@ private void verifyElasticsearchAccessTokenForRoleMapping(String accessToken) th
315315
}
316316

317317
/**
318-
* Verifies that the provided "Access Token" (see {@link org.elasticsearch.xpack.security.authc.TokenService})
318+
* Verifies that the provided "Access Token" (see org.elasticsearch.xpack.security.authc.TokenService)
319319
* is for the expected user with the expected name and roles if the user was retrieved from the native realm
320320
*/
321321
private void verifyElasticsearchAccessTokenForAuthorizingRealms(String accessToken) throws IOException {
@@ -602,7 +602,7 @@ private Response samlAuthenticate(HttpExchange http) throws IOException {
602602
assertThat(id, notNullValue());
603603
assertThat(realmName, notNullValue());
604604

605-
final MapBuilder<String, Object> bodyBuilder = new MapBuilder()
605+
final MapBuilder<String, Object> bodyBuilder = new MapBuilder<String, Object>()
606606
.put("content", saml)
607607
.put("ids", Collections.singletonList(id));
608608
if (randomBoolean()) {
@@ -643,7 +643,7 @@ private Tuple<String, String> getCookie(HttpExchange http) throws IOException {
643643
final List<Cookie> parsed = new DefaultCookieSpec().parse(header, origin);
644644
return parsed.stream().filter(c -> SAML_REQUEST_COOKIE.equals(c.getName())).map(c -> {
645645
String[] values = c.getValue().split("&");
646-
return new Tuple(values[0], values[1]);
646+
return Tuple.tuple(values[0], values[1]);
647647
}).findFirst().orElse(null);
648648
} catch (MalformedCookieException e) {
649649
throw new IOException("Cannot read cookies", e);

0 commit comments

Comments
 (0)