Skip to content

Commit ddd068a

Browse files
authored
Encore consistent compile options across all projects (elastic#54120)
1 parent dc0d35e commit ddd068a

File tree

10 files changed

+17
-21
lines changed

10 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
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,7 @@ private void assertHistoryIsPresent(String policyName, String indexName, boolean
15561556
}
15571557

15581558
// This method should be called inside an assertBusy, it has no retry logic of its own
1559+
@SuppressWarnings("unchecked")
15591560
private void assertHistoryIsPresent(String policyName, String indexName, boolean success,
15601561
@Nullable String phase, @Nullable String action, String stepName) throws IOException {
15611562
logger.info("--> checking for history item [{}], [{}], success: [{}], phase: [{}], action: [{}], step: [{}]",

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
@@ -573,6 +573,7 @@ private Map<String, Object> getSLMStats() {
573573
}
574574

575575
// This method should be called inside an assertBusy, it has no retry logic of its own
576+
@SuppressWarnings("unchecked")
576577
private void assertHistoryIsPresent(String policyName, boolean success, String repository, String operation) throws IOException {
577578
final Request historySearchRequest = new Request("GET", ".slm-history*/_search");
578579
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
@@ -314,7 +314,8 @@ protected static void assertMlResultsFieldMappings(String index, String predicte
314314
* - allows dots (".") in the path elements provided as arguments
315315
* - supports implicit casting to the appropriate type
316316
*/
317+
@SuppressWarnings("unchecked")
317318
protected static <T> T getFieldValue(Map<String, Object> doc, String... path) {
318-
return (T)extractValue(String.join(".", path), doc);
319+
return (T) extractValue(String.join(".", path), doc);
319320
}
320321
}

x-pack/plugin/security/qa/security-trial/src/test/java/org/elasticsearch/xpack/security/SecurityOnTrialLicenseRestTestCase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected Tuple<String, String> createOAuthToken(String username, SecureString p
7272
final RestHighLevelClient client = getHighLevelAdminClient();
7373
final CreateTokenRequest request = CreateTokenRequest.passwordGrant(username, password.getChars());
7474
final CreateTokenResponse response = client.security().createToken(request, RequestOptions.DEFAULT);
75-
return new Tuple(response.getAccessToken(), response.getRefreshToken());
75+
return Tuple.tuple(response.getAccessToken(), response.getRefreshToken());
7676
}
7777

7878
protected void deleteUser(String username) throws IOException {

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

x-pack/qa/smoke-test-plugins-ssl/src/test/java/org/elasticsearch/smoketest/SmokeTestMonitoringWithSecurityIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ public void testSettingsFilter() throws IOException {
257257
assertThat(settings, not(hasKey("ssl")));
258258
}
259259

260+
@SuppressWarnings("unchecked")
260261
private String randomNodeHttpAddress() throws IOException {
261262
Response response = client().performRequest(new Request("GET", "/_nodes"));
262263
assertOK(response);

0 commit comments

Comments
 (0)