From 05420c370018faf57af4beee30529693bfca4d28 Mon Sep 17 00:00:00 2001 From: Benoit Lacelle Date: Thu, 25 May 2023 18:01:07 +0400 Subject: [PATCH 1/2] Upgrade to CleanThat 2.16. Include management of JDK17 Sealed classes for Unnecessaryimports --- lib/build.gradle | 2 +- .../java/com/diffplug/spotless/java/CleanthatJavaStep.java | 2 +- .../java/removeunusedimports/SealedClassTestsFormatted.test | 1 - .../RemoveUnusedImportsStep_withCleanthatJavaparserTest.java | 3 +-- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/build.gradle b/lib/build.gradle index 6a611252a6..a9d5181569 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -70,7 +70,7 @@ dependencies { // GLUE CODE (alphabetic order please) // cleanthat - String VER_CLEANTHAT='2.13' + String VER_CLEANTHAT='2.16' cleanthatCompileOnly "io.github.solven-eu.cleanthat:java:$VER_CLEANTHAT" compatCleanthat2Dot1CompileAndTestOnly "io.github.solven-eu.cleanthat:java:$VER_CLEANTHAT" // diktat diff --git a/lib/src/main/java/com/diffplug/spotless/java/CleanthatJavaStep.java b/lib/src/main/java/com/diffplug/spotless/java/CleanthatJavaStep.java index 92b7daa5f6..91439a1767 100644 --- a/lib/src/main/java/com/diffplug/spotless/java/CleanthatJavaStep.java +++ b/lib/src/main/java/com/diffplug/spotless/java/CleanthatJavaStep.java @@ -40,7 +40,7 @@ public final class CleanthatJavaStep { private static final String MAVEN_COORDINATE = "io.github.solven-eu.cleanthat:java"; // CleanThat changelog is available at https://github.com/solven-eu/cleanthat/blob/master/CHANGES.MD - private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(11, "2.13"); + private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(11, "2.16"); // prevent direct instantiation private CleanthatJavaStep() {} diff --git a/testlib/src/main/resources/java/removeunusedimports/SealedClassTestsFormatted.test b/testlib/src/main/resources/java/removeunusedimports/SealedClassTestsFormatted.test index 2ef96e6c72..f0a0459883 100644 --- a/testlib/src/main/resources/java/removeunusedimports/SealedClassTestsFormatted.test +++ b/testlib/src/main/resources/java/removeunusedimports/SealedClassTestsFormatted.test @@ -14,7 +14,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import org.junit.jupiter.api.Test; - class SealedClassTests extends AbstractJupiterTestEngineTests { @Test diff --git a/testlib/src/test/java/com/diffplug/spotless/java/RemoveUnusedImportsStep_withCleanthatJavaparserTest.java b/testlib/src/test/java/com/diffplug/spotless/java/RemoveUnusedImportsStep_withCleanthatJavaparserTest.java index 11e31aeae2..69b472554f 100644 --- a/testlib/src/test/java/com/diffplug/spotless/java/RemoveUnusedImportsStep_withCleanthatJavaparserTest.java +++ b/testlib/src/test/java/com/diffplug/spotless/java/RemoveUnusedImportsStep_withCleanthatJavaparserTest.java @@ -33,8 +33,7 @@ void behavior() throws Exception { .testResource("java/removeunusedimports/JavaCodeWithPackageUnformatted.test", "java/removeunusedimports/JavaCodeWithPackageFormatted.test") .testResource("java/removeunusedimports/Jdk17TextBlockUnformatted.test", "java/removeunusedimports/Jdk17TextBlockFormatted.test") .testResource("java/removeunusedimports/RevelcUnformatted.test", "java/removeunusedimports/RevelcFormatted.test") - // Sealed classes are introduced with JDK15: This syntax is not supported by javaParser: such files are not trimmed from unused imports (for now) - .testResource("java/removeunusedimports/SealedClassTestsUnformatted.test", "java/removeunusedimports/SealedClassTestsUnformatted.test"); + .testResource("java/removeunusedimports/SealedClassTestsUnformatted.test", "java/removeunusedimports/SealedClassTestsFormatted.test"); } @Test From 615ca6c9b1f06ff2a8994e224d24ae3a1eaff597 Mon Sep 17 00:00:00 2001 From: Benoit Lacelle Date: Thu, 25 May 2023 21:28:57 +0400 Subject: [PATCH 2/2] Add changelog entry --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index e545f20dcb..08c785dae9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,8 @@ This document is intended for Spotless developers. We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Changes +* Bump default `cleanthat` version to latest `2.13` -> `2.16`. ([#1725](https://github.com/diffplug/spotless/pull/1725)) ## [2.39.0] - 2023-05-24 ### Added