Skip to content

Commit 0b95d17

Browse files
authored
Merge branch 'main' into mvn-protobuf-port
2 parents 0c6523b + c43b545 commit 0b95d17

File tree

11 files changed

+31
-12
lines changed

11 files changed

+31
-12
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1717
* Support configuring the Equo P2 cache. ([#2238](https://github.com/diffplug/spotless/pull/2238))
1818
* Add explicit support for JSONC / CSS via biome, via the file extensions `.css` and `.jsonc`.
1919
([#2259](https://github.com/diffplug/spotless/pull/2259))
20+
* Bump default `jackson` version to latest `2.17.2` -> `2.18.0`. ([#2279](https://github.com/diffplug/spotless/pull/2279))
2021
* Bump default `buf` version to latest `1.24.0` -> `1.44.0`. ([#2291](https://github.com/diffplug/spotless/pull/2291))
22+
### Fixed
23+
* Java import order, ignore duplicate group entries. ([#2293](https://github.com/diffplug/spotless/pull/2293))
2124

2225
## [3.0.0.BETA2] - 2024-08-25
2326
### Changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ VER_SLF4J=[1.6,2.0[
2929
# Used in multiple places
3030
VER_DURIAN=1.2.0
3131
VER_JGIT=6.10.0.202406032230-r
32-
VER_JUNIT=5.11.1
32+
VER_JUNIT=5.11.2
3333
VER_ASSERTJ=3.26.3
3434
VER_MOCKITO=5.14.1

lib-extra/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version = rootProject.spotlessChangelog.versionNext
77
apply from: rootProject.file('gradle/java-setup.gradle')
88
apply from: rootProject.file('gradle/java-publish.gradle')
99

10-
String VER_SOLSTICE = '1.7.7'
10+
String VER_SOLSTICE = '1.8.0'
1111
dependencies {
1212
api projects.lib
1313
// misc useful utilities

lib-extra/src/main/java/com/diffplug/spotless/extra/EquoBasedStepBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public FormatterStep build() {
116116
}
117117
var classpath = new ArrayList<File>();
118118
var mavenDeps = new ArrayList<String>();
119-
mavenDeps.add("dev.equo.ide:solstice:1.7.7");
119+
mavenDeps.add("dev.equo.ide:solstice:1.8.0");
120120
mavenDeps.add("com.diffplug.durian:durian-swt.os:4.2.0");
121121
mavenDeps.addAll(query.getJarsOnMavenCentral());
122122
classpath.addAll(mavenProvisioner.provisionWithTransitives(false, mavenDeps));

lib/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ dependencies {
9797
// gson
9898
gsonCompileOnly 'com.google.code.gson:gson:2.11.0'
9999
// jackson
100-
String VER_JACKSON='2.17.2'
100+
String VER_JACKSON='2.18.0'
101101
jacksonCompileOnly "com.fasterxml.jackson.core:jackson-databind:$VER_JACKSON"
102102
jacksonCompileOnly "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$VER_JACKSON"
103103
// ktfmt

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

Lines changed: 8 additions & 5 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.
@@ -33,6 +33,7 @@ final class ImportSorterImpl {
3333
private static final String SUBGROUP_SEPARATOR = "|";
3434

3535
private final List<ImportsGroup> importsGroups;
36+
private final Set<String> knownGroupings = new HashSet<>();
3637
private final Map<String, List<String>> matchingImports = new HashMap<>();
3738
private final List<String> notMatching = new ArrayList<>();
3839
private final Set<String> allImportOrderItems = new HashSet<>();
@@ -44,10 +45,12 @@ private static class ImportsGroup {
4445

4546
private final List<String> subGroups;
4647

47-
public ImportsGroup(String importOrder) {
48+
public ImportsGroup(String importOrder, Set<String> knownGroupings) {
4849
this.subGroups = Stream.of(importOrder.split("\\" + SUBGROUP_SEPARATOR, -1))
4950
.map(this::normalizeStatic)
51+
.filter(group -> !knownGroupings.contains(group))
5052
.collect(Collectors.toList());
53+
knownGroupings.addAll(this.subGroups);
5154
}
5255

5356
private String normalizeStatic(String subgroup) {
@@ -80,7 +83,7 @@ private List<String> sort(List<String> imports, String lineFormat) {
8083

8184
private ImportSorterImpl(List<String> importOrder, boolean wildcardsLast, boolean semanticSort,
8285
Set<String> treatAsPackage, Set<String> treatAsClass) {
83-
importsGroups = importOrder.stream().filter(Objects::nonNull).map(ImportsGroup::new).collect(Collectors.toList());
86+
importsGroups = importOrder.stream().filter(Objects::nonNull).map(order -> new ImportsGroup(order, knownGroupings)).collect(Collectors.toList());
8487
putStaticItemIfNotExists(importsGroups);
8588
putCatchAllGroupIfNotExists(importsGroups);
8689

@@ -107,13 +110,13 @@ private void putStaticItemIfNotExists(List<ImportsGroup> importsGroups) {
107110
indexOfFirstStatic = i;
108111
}
109112
}
110-
importsGroups.add(indexOfFirstStatic, new ImportsGroup(STATIC_KEYWORD));
113+
importsGroups.add(indexOfFirstStatic, new ImportsGroup(STATIC_KEYWORD, this.knownGroupings));
111114
}
112115

113116
private void putCatchAllGroupIfNotExists(List<ImportsGroup> importsGroups) {
114117
boolean catchAllSubGroupExist = importsGroups.stream().anyMatch(group -> group.getSubGroups().contains(CATCH_ALL_SUBGROUP));
115118
if (!catchAllSubGroupExist) {
116-
importsGroups.add(new ImportsGroup(CATCH_ALL_SUBGROUP));
119+
importsGroups.add(new ImportsGroup(CATCH_ALL_SUBGROUP, this.knownGroupings));
117120
}
118121
}
119122

lib/src/main/java/com/diffplug/spotless/json/JacksonJsonStep.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public class JacksonJsonStep implements Serializable {
3333
private static final long serialVersionUID = 1L;
3434
private static final String MAVEN_COORDINATE = "com.fasterxml.jackson.core:jackson-databind:";
35-
private static final String DEFAULT_VERSION = "2.17.2";
35+
private static final String DEFAULT_VERSION = "2.18.0";
3636
public static final String NAME = "jacksonJson";
3737

3838
private final JarState.Promised jarState;

plugin-gradle/CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
44

55
## [Unreleased]
66
### Added
7+
### Changed
78
* Use the Gradle user home directory by default for the download directory for the biome executable. Previously, the
89
plugin tried to use Maven's home directory, which is not always accessible by a Gradle plugin. ([#2187](https://github.com/diffplug/spotless/issues/2187))
910
* Add explicit support for CSS via biome. Formatting CSS via biome was already supported as a general
1011
formatting step. Biome supports formatting CSS as of 1.8.0 (experimental, opt-in) and 1.9.0 (stable).
1112
([#2259](https://github.com/diffplug/spotless/pull/2259))
1213
### Changed
14+
* Bump default `jackson` version to latest `2.17.2` -> `2.18.0`. ([#2279](https://github.com/diffplug/spotless/pull/2279))
1315
* Bump default `buf` version to latest `1.24.0` -> `1.44.0`. ([#2291](https://github.com/diffplug/spotless/pull/2291))
16+
### Fixed
17+
* Java import order, ignore duplicate group entries. ([#2293](https://github.com/diffplug/spotless/pull/2293))
1418

1519
## [7.0.0.BETA2] - 2024-08-25
1620
### Changed

plugin-maven/CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1111
* Add explicit support for CSS via biome. Formatting CSS via biome was already supported as a general
1212
formatting step. Biome supports formatting CSS as of 1.8.0 (experimental, opt-in) and 1.9.0 (stable).
1313
([#2259](https://github.com/diffplug/spotless/pull/2259))
14+
* Bump default `jackson` version to latest `2.17.2` -> `2.18.0`. ([#2279](https://github.com/diffplug/spotless/pull/2279))
15+
### Fixed
16+
* Java import order, ignore duplicate group entries. ([#2293](https://github.com/diffplug/spotless/pull/2293))
1417

1518
## [2.44.0.BETA2] - 2024-08-25
1619
### Changed

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plugins {
1212
// https://github.com/gradle-nexus/publish-plugin/releases
1313
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' apply false
1414
// https://github.com/spotbugs/spotbugs-gradle-plugin/releases
15-
id 'com.github.spotbugs' version '6.0.23' apply false
15+
id 'com.github.spotbugs' version '6.0.24' apply false
1616
// https://github.com/diffplug/spotless-changelog/blob/main/CHANGELOG.md
1717
id 'com.diffplug.spotless-changelog' version '3.1.2' apply false
1818
// https://github.com/radarsh/gradle-test-logger-plugin/blob/develop/CHANGELOG.md

0 commit comments

Comments
 (0)