Skip to content

Commit 8b6157f

Browse files
authored
Bump google-java-format to 1.19.2 (#1971)
2 parents fd2cc2f + f4e631c commit 8b6157f

File tree

8 files changed

+11
-30
lines changed

8 files changed

+11
-30
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1414
* New static method to `DiffMessageFormatter` which allows to retrieve diffs with their line numbers ([#1960](https://github.com/diffplug/spotless/issues/1960))
1515
### Changes
1616
* Use palantir-java-format 2.39.0 on Java 21. ([#1948](https://github.com/diffplug/spotless/pull/1948))
17+
* Bump default `googleJavaFormat` version to latest `1.18.1` -> `1.19.2`. ([#1971](https://github.com/diffplug/spotless/pull/1971))
1718

1819
## [2.43.1] - 2023-12-04
1920
### Fixed

lib/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ dependencies {
9393
gherkinCompileOnly 'io.cucumber:gherkin-utils:8.0.2'
9494
gherkinCompileOnly 'org.slf4j:slf4j-api:2.0.0'
9595
// googleJavaFormat
96-
googleJavaFormatCompileOnly 'com.google.googlejavaformat:google-java-format:1.18.1'
96+
googleJavaFormatCompileOnly 'com.google.googlejavaformat:google-java-format:1.19.2'
9797
// gson
9898
gsonCompileOnly 'com.google.code.gson:gson:2.10.1'
9999
// jackson

lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 DiffPlug
2+
* Copyright 2016-2024 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -83,7 +83,7 @@ public static FormatterStep create(String groupArtifact, String version, String
8383
.addMin(11, "1.8") // we only support google-java-format >= 1.8 due to api changes
8484
.addMin(16, "1.10.0") // java 16 requires at least 1.10.0 due to jdk api changes in JavaTokenizer
8585
.addMin(21, "1.17.0") // java 21 requires at least 1.17.0 due to https://github.com/google/google-java-format/issues/898
86-
.add(11, "1.18.1"); // default version
86+
.add(11, "1.19.2"); // default version
8787

8888
public static String defaultGroupArtifact() {
8989
return MAVEN_COORDINATE;

lib/src/main/java/com/diffplug/spotless/java/PalantirJavaFormatStep.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 DiffPlug
2+
* Copyright 2016-2024 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

plugin-gradle/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
55
## [Unreleased]
66
### Changes
77
* Use palantir-java-format 2.39.0 on Java 21. ([#1948](https://github.com/diffplug/spotless/pull/1948))
8+
* Bump default `googleJavaFormat` version to latest `1.18.1` -> `1.19.2`. ([#1971](https://github.com/diffplug/spotless/pull/1971))
89
* Bump default `diktat` version to latest `1.2.5` -> `2.0.0`. ([#1972](https://github.com/diffplug/spotless/pull/1972))
910

1011
## [6.23.3] - 2023-12-04

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/GradleProvisioner.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 DiffPlug
2+
* Copyright 2016-2024 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,8 +36,6 @@
3636
import com.diffplug.common.base.Unhandled;
3737
import com.diffplug.common.collect.ImmutableList;
3838
import com.diffplug.spotless.Provisioner;
39-
import com.diffplug.spotless.java.GoogleJavaFormatStep;
40-
import com.diffplug.spotless.java.PalantirJavaFormatStep;
4139

4240
/** Should be package-private. */
4341
class GradleProvisioner {
@@ -119,16 +117,7 @@ private static Provisioner forConfigurationContainer(Project project, Configurat
119117
+ new Request(withTransitives, mavenCoords).hashCode());
120118
mavenCoords.stream()
121119
.map(dependencies::create)
122-
.forEach(dependency -> {
123-
config.getDependencies().add(dependency);
124-
String coordinate = dependency.getGroup() + ":" + dependency.getName();
125-
if (coordinate.startsWith(GoogleJavaFormatStep.MAVEN_COORDINATE) ||
126-
coordinate.startsWith(PalantirJavaFormatStep.MAVEN_COORDINATE)) {
127-
// Use Guava 32.1.3, see https://github.com/google/guava/issues/6657.
128-
// TODO: May remove this after https://github.com/google/google-java-format/pull/996 and https://github.com/palantir/palantir-java-format/issues/957 are released.
129-
config.getDependencies().add(dependencies.create("com.google.guava:guava:32.1.3-jre"));
130-
}
131-
});
120+
.forEach(config.getDependencies()::add);
132121
config.setDescription(mavenCoords.toString());
133122
config.setTransitive(withTransitives);
134123
config.setCanBeConsumed(false);

plugin-maven/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
77
* M2E support: Emit file specific errors during incremental build. ([#1960](https://github.com/diffplug/spotless/issues/1960))
88
### Changes
99
* Use palantir-java-format 2.39.0 on Java 21. ([#1948](https://github.com/diffplug/spotless/pull/1948))
10+
* Bump default `googleJavaFormat` version to latest `1.18.1` -> `1.19.2`. ([#1971](https://github.com/diffplug/spotless/pull/1971))
1011
* Bump default `diktat` version to latest `1.2.5` -> `2.0.0`. ([#1972](https://github.com/diffplug/spotless/pull/1972))
1112

1213
## [2.41.1] - 2023-12-04

testlib/src/main/java/com/diffplug/spotless/TestProvisioner.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2023 DiffPlug
2+
* Copyright 2016-2024 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,6 @@
2525
import java.util.Map;
2626
import java.util.function.Consumer;
2727
import java.util.function.Supplier;
28-
import java.util.stream.Stream;
2928

3029
import org.gradle.api.Project;
3130
import org.gradle.api.artifacts.Configuration;
@@ -42,8 +41,6 @@
4241
import com.diffplug.common.base.Suppliers;
4342
import com.diffplug.common.collect.ImmutableSet;
4443
import com.diffplug.common.io.Files;
45-
import com.diffplug.spotless.java.GoogleJavaFormatStep;
46-
import com.diffplug.spotless.java.PalantirJavaFormatStep;
4744

4845
public class TestProvisioner {
4946
public static Project gradleProject(File dir) {
@@ -68,15 +65,7 @@ private static Provisioner createWithRepositories(Consumer<RepositoryHandler> re
6865
Project project = TestProvisioner.gradleProject(tempDir);
6966
repoConfig.accept(project.getRepositories());
7067
return (withTransitives, mavenCoords) -> {
71-
boolean forceGuava = mavenCoords.stream().anyMatch(coordinate -> coordinate.startsWith(GoogleJavaFormatStep.MAVEN_COORDINATE) ||
72-
coordinate.startsWith(PalantirJavaFormatStep.MAVEN_COORDINATE));
73-
Stream<String> coordinateStream = mavenCoords.stream();
74-
if (forceGuava) {
75-
// Use Guava 32.1.3, see https://github.com/google/guava/issues/6657.
76-
// TODO: May remove this after https://github.com/google/google-java-format/pull/996 and https://github.com/palantir/palantir-java-format/issues/957 are released.
77-
coordinateStream = Stream.concat(coordinateStream, Stream.of("com.google.guava:guava:32.1.3-jre"));
78-
}
79-
Dependency[] deps = coordinateStream
68+
Dependency[] deps = mavenCoords.stream()
8069
.map(project.getDependencies()::create)
8170
.toArray(Dependency[]::new);
8271
Configuration config = project.getConfigurations().detachedConfiguration(deps);

0 commit comments

Comments
 (0)