Skip to content

Commit fe1083f

Browse files
authored
Upgrade spotless plugin to 6.17.0 (#94994)
Fixes #82794. Upgrade the spotless plugin, which addresses the issue around formatting `instanceof` expressions. Formatting of statements including lambdas seems to have improved too.
1 parent 696e635 commit fe1083f

File tree

349 files changed

+2104
-2716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

349 files changed

+2104
-2716
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/index/mapper/MapperServiceFactory.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public static MapperService create(String mappings) {
6060
.withDeprecationHandler(LoggingDeprecationHandler.INSTANCE),
6161
similarityService,
6262
mapperRegistry,
63-
() -> { throw new UnsupportedOperationException(); },
63+
() -> {
64+
throw new UnsupportedOperationException();
65+
},
6466
new ProvidedIdFieldMapper(() -> true),
6567
new ScriptCompiler() {
6668
@Override

benchmarks/src/main/java/org/elasticsearch/benchmark/search/QueryParserHelperBenchmark.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ protected final MapperService createMapperService(String mappings) {
175175
.withDeprecationHandler(LoggingDeprecationHandler.INSTANCE),
176176
similarityService,
177177
mapperRegistry,
178-
() -> { throw new UnsupportedOperationException(); },
178+
() -> {
179+
throw new UnsupportedOperationException();
180+
},
179181
new ProvidedIdFieldMapper(() -> true),
180182
new ScriptCompiler() {
181183
@Override

benchmarks/src/main/java/org/elasticsearch/benchmark/vector/DistanceFunctionBenchmark.java

+32-32
Original file line numberDiff line numberDiff line change
@@ -406,50 +406,50 @@ public void setBenchmarkFunction() {
406406
case "float" -> {
407407
switch (function) {
408408
case "dot" -> benchmarkFunction = switch (type) {
409-
case "knn" -> new DotKnnFloatBenchmarkFunction(dims);
410-
case "binary" -> new DotBinaryFloatBenchmarkFunction(dims);
411-
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
412-
};
409+
case "knn" -> new DotKnnFloatBenchmarkFunction(dims);
410+
case "binary" -> new DotBinaryFloatBenchmarkFunction(dims);
411+
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
412+
};
413413
case "cosine" -> benchmarkFunction = switch (type) {
414-
case "knn" -> new CosineKnnFloatBenchmarkFunction(dims);
415-
case "binary" -> new CosineBinaryFloatBenchmarkFunction(dims);
416-
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
417-
};
414+
case "knn" -> new CosineKnnFloatBenchmarkFunction(dims);
415+
case "binary" -> new CosineBinaryFloatBenchmarkFunction(dims);
416+
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
417+
};
418418
case "l1" -> benchmarkFunction = switch (type) {
419-
case "knn" -> new L1KnnFloatBenchmarkFunction(dims);
420-
case "binary" -> new L1BinaryFloatBenchmarkFunction(dims);
421-
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
422-
};
419+
case "knn" -> new L1KnnFloatBenchmarkFunction(dims);
420+
case "binary" -> new L1BinaryFloatBenchmarkFunction(dims);
421+
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
422+
};
423423
case "l2" -> benchmarkFunction = switch (type) {
424-
case "knn" -> new L2KnnFloatBenchmarkFunction(dims);
425-
case "binary" -> new L2BinaryFloatBenchmarkFunction(dims);
426-
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
427-
};
424+
case "knn" -> new L2KnnFloatBenchmarkFunction(dims);
425+
case "binary" -> new L2BinaryFloatBenchmarkFunction(dims);
426+
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
427+
};
428428
default -> throw new UnsupportedOperationException("unexpected function [" + function + "]");
429429
}
430430
}
431431
case "byte" -> {
432432
switch (function) {
433433
case "dot" -> benchmarkFunction = switch (type) {
434-
case "knn" -> new DotKnnByteBenchmarkFunction(dims);
435-
case "binary" -> new DotBinaryByteBenchmarkFunction(dims);
436-
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
437-
};
434+
case "knn" -> new DotKnnByteBenchmarkFunction(dims);
435+
case "binary" -> new DotBinaryByteBenchmarkFunction(dims);
436+
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
437+
};
438438
case "cosine" -> benchmarkFunction = switch (type) {
439-
case "knn" -> new CosineKnnByteBenchmarkFunction(dims);
440-
case "binary" -> new CosineBinaryByteBenchmarkFunction(dims);
441-
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
442-
};
439+
case "knn" -> new CosineKnnByteBenchmarkFunction(dims);
440+
case "binary" -> new CosineBinaryByteBenchmarkFunction(dims);
441+
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
442+
};
443443
case "l1" -> benchmarkFunction = switch (type) {
444-
case "knn" -> new L1KnnByteBenchmarkFunction(dims);
445-
case "binary" -> new L1BinaryByteBenchmarkFunction(dims);
446-
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
447-
};
444+
case "knn" -> new L1KnnByteBenchmarkFunction(dims);
445+
case "binary" -> new L1BinaryByteBenchmarkFunction(dims);
446+
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
447+
};
448448
case "l2" -> benchmarkFunction = switch (type) {
449-
case "knn" -> new L2KnnByteBenchmarkFunction(dims);
450-
case "binary" -> new L2BinaryByteBenchmarkFunction(dims);
451-
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
452-
};
449+
case "knn" -> new L2KnnByteBenchmarkFunction(dims);
450+
case "binary" -> new L2BinaryByteBenchmarkFunction(dims);
451+
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
452+
};
453453
default -> throw new UnsupportedOperationException("unexpected function [" + function + "]");
454454
}
455455
}

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchJavaModulePathPlugin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static Stream<ComponentIdentifier> walkResolvedComponent(
133133
return false;
134134
}
135135
return isModuleDependency
136-
|| (it.getId()instanceof ProjectComponentIdentifier projectId && hasModuleInfoDotJava(project, projectId));
136+
|| (it.getId() instanceof ProjectComponentIdentifier projectId && hasModuleInfoDotJava(project, projectId));
137137
})
138138
.flatMap(it -> Stream.concat(walkResolvedComponent(project, it, true, visited), Stream.of(it.getId())));
139139
}

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java

+3-6
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,9 @@ public InternalDistributionBwcSetupPlugin(ProviderFactory providerFactory) {
5454
@Override
5555
public void apply(Project project) {
5656
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
57-
BuildParams.getBwcVersions()
58-
.forPreviousUnreleased(
59-
(BwcVersions.UnreleasedVersionInfo unreleasedVersion) -> {
60-
configureBwcProject(project.project(unreleasedVersion.gradleProjectPath()), unreleasedVersion);
61-
}
62-
);
57+
BuildParams.getBwcVersions().forPreviousUnreleased((BwcVersions.UnreleasedVersionInfo unreleasedVersion) -> {
58+
configureBwcProject(project.project(unreleasedVersion.gradleProjectPath()), unreleasedVersion);
59+
});
6360
}
6461

6562
private void configureBwcProject(Project project, BwcVersions.UnreleasedVersionInfo versionInfo) {

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/docker/DockerSupportPlugin.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,9 @@ public void apply(Project project) {
3232

3333
Provider<DockerSupportService> dockerSupportServiceProvider = project.getGradle()
3434
.getSharedServices()
35-
.registerIfAbsent(
36-
DOCKER_SUPPORT_SERVICE_NAME,
37-
DockerSupportService.class,
38-
spec -> spec.parameters(
39-
params -> { params.setExclusionsFile(new File(project.getRootDir(), DOCKER_ON_LINUX_EXCLUSIONS_FILE)); }
40-
)
41-
);
35+
.registerIfAbsent(DOCKER_SUPPORT_SERVICE_NAME, DockerSupportService.class, spec -> spec.parameters(params -> {
36+
params.setExclusionsFile(new File(project.getRootDir(), DOCKER_ON_LINUX_EXCLUSIONS_FILE));
37+
}));
4238

4339
// Ensure that if we are trying to run any DockerBuildTask tasks, we assert an available Docker installation exists
4440
project.getGradle().getTaskGraph().whenReady(graph -> {

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/DistroTestPlugin.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,9 @@ public void apply(Project project) {
199199

200200
// windows boxes get windows distributions, and linux boxes get linux distributions
201201
if (isWindows(vmProject)) {
202-
configureVMWrapperTasks(
203-
vmProject,
204-
windowsTestTasks,
205-
depsTasks,
206-
wrapperTask -> { vmLifecyleTasks.get(ARCHIVE).configure(t -> t.dependsOn(wrapperTask)); },
207-
vmDependencies
208-
);
202+
configureVMWrapperTasks(vmProject, windowsTestTasks, depsTasks, wrapperTask -> {
203+
vmLifecyleTasks.get(ARCHIVE).configure(t -> t.dependsOn(wrapperTask));
204+
}, vmDependencies);
209205
} else {
210206
for (var entry : linuxTestTasks.entrySet()) {
211207
ElasticsearchDistributionType type = entry.getKey();

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/transform/RestTestTransformer.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ private void traverseTest(
130130
}
131131
}
132132
}
133-
currentNode.elements()
134-
.forEachRemaining(node -> { traverseTest(testContext, node, parentKeyName, objectKeyFinders, arrayByObjectKeyFinders); });
133+
currentNode.elements().forEachRemaining(node -> {
134+
traverseTest(testContext, node, parentKeyName, objectKeyFinders, arrayByObjectKeyFinders);
135+
});
135136
} else if (currentNode.isObject()) {
136137
currentNode.fields().forEachRemaining(entry -> {
137138
List<RestTestTransformByParentObject> transforms = objectKeyFinders.get(entry.getKey());

build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ private void sync(Path sourceRoot, Path destinationRoot, BiConsumer<Path, Path>
13721372
}
13731373
});
13741374
} catch (UncheckedIOException e) {
1375-
if (e.getCause()instanceof NoSuchFileException cause) {
1375+
if (e.getCause() instanceof NoSuchFileException cause) {
13761376
// Ignore these files that are sometimes left behind by the JVM
13771377
if (cause.getFile() == null || cause.getFile().contains(".attach_pid") == false) {
13781378
throw new UncheckedIOException(cause);

build-tools/src/main/java/org/elasticsearch/gradle/util/Pair.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
package org.elasticsearch.gradle.util;
1010

11-
public record Pair<L, R> (L left, R right) {
11+
public record Pair<L, R>(L left, R right) {
1212

1313
public static <L, R> Pair<L, R> of(L left, R right) {
1414
return new Pair<>(left, right);

client/rest-high-level/src/main/java/org/elasticsearch/client/core/MainResponse.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ public class MainResponse {
1919
private static final ConstructingObjectParser<MainResponse, Void> PARSER = new ConstructingObjectParser<>(
2020
MainResponse.class.getName(),
2121
true,
22-
args -> { return new MainResponse((String) args[0], (Version) args[1], (String) args[2], (String) args[3], (String) args[4]); }
22+
args -> {
23+
return new MainResponse((String) args[0], (Version) args[1], (String) args[2], (String) args[3], (String) args[4]);
24+
}
2325
);
2426

2527
static {

distribution/archives/integ-test-zip/src/javaRestTest/java/org/elasticsearch/test/rest/NodeRestUsageIT.java

+17-17
Original file line numberDiff line numberDiff line change
@@ -143,24 +143,24 @@ public void testAggregationUsage() throws IOException {
143143
// Do some requests to get some rest usage stats
144144
Request create = new Request("PUT", "/test");
145145
create.setJsonEntity("""
146-
{
147-
"mappings": {
148-
"properties": {
149-
"str": {
150-
"type": "keyword"
151-
},
152-
"foo": {
153-
"type": "keyword"
154-
},
155-
"num": {
156-
"type": "long"
157-
},
158-
"start": {
159-
"type": "date"
160-
}
161-
}
146+
{
147+
"mappings": {
148+
"properties": {
149+
"str": {
150+
"type": "keyword"
151+
},
152+
"foo": {
153+
"type": "keyword"
154+
},
155+
"num": {
156+
"type": "long"
157+
},
158+
"start": {
159+
"type": "date"
162160
}
163-
}""");
161+
}
162+
}
163+
}""");
164164
client().performRequest(create);
165165

166166
Request searchRequest = new Request("GET", "/test/_search");

gradle/build.versions.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ shadow-plugin = "gradle.plugin.com.github.johnrengelman:shadow:7.1.2"
3939
spock-core = { group = "org.spockframework", name="spock-core", version.ref="spock" }
4040
spock-junit4 = { group = "org.spockframework", name="spock-junit4", version.ref="spock" }
4141
spock-platform = { group = "org.spockframework", name="spock-bom", version.ref="spock" }
42-
spotless-plugin = "com.diffplug.spotless:spotless-plugin-gradle:6.11.0"
42+
spotless-plugin = "com.diffplug.spotless:spotless-plugin-gradle:6.17.0"
4343
wiremock = "com.github.tomakehurst:wiremock-jre8-standalone:2.23.2"
4444
xmlunit-core = "org.xmlunit:xmlunit-core:2.8.2"

0 commit comments

Comments
 (0)