diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ef9b7582b..7ded2ca9f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: matrix: kind: [maven, gradle] # Test on the latest Java version once Gradle & Maven support it. - jre: [17, 21, 24] + jre: [17, 21, 25] os: [ubuntu-latest, windows-latest] include: # npm on linux only (crazy slow on windows) diff --git a/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java b/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java index c4f763685f..68b927c137 100644 --- a/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java +++ b/lib/src/main/java/com/diffplug/spotless/java/GoogleJavaFormatStep.java @@ -121,6 +121,7 @@ private static FormatterStep createInternally(String name, String groupArtifact, .addMin(11, "1.8") // we only support google-java-format >= 1.8 due to api changes .addMin(16, "1.10.0") // java 16 requires at least 1.10.0 due to jdk api changes in JavaTokenizer .addMin(21, "1.17.0") // java 21 requires at least 1.17.0 due to https://github.com/google/google-java-format/issues/898 + .addMin(25, "1.27.0") .add(17, "1.28.0"); // default version public static String defaultGroupArtifact() { diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java index e7fc9d4b74..21dd1f0d64 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GoogleJavaFormatIntegrationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 DiffPlug + * Copyright 2016-2025 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ void integration() throws IOException { "spotless {", " java {", " target file('test.java')", - " googleJavaFormat('1.17.0')", + " googleJavaFormat('1.27.0')", " }", "}"); @@ -41,8 +41,8 @@ void integration() throws IOException { checkRunsThenUpToDate(); replace("build.gradle", - "googleJavaFormat('1.17.0')", - "googleJavaFormat()"); + "googleJavaFormat('1.27.0')", + "googleJavaFormat('1.28.0')"); checkRunsThenUpToDate(); } @@ -57,7 +57,7 @@ void integrationWithReorderImports() throws IOException { "spotless {", " java {", " target file('test.java')", - " googleJavaFormat('1.17.0').aosp().reorderImports(true)", + " googleJavaFormat('1.27.0').aosp().reorderImports(true)", " }", "}"); @@ -67,8 +67,8 @@ void integrationWithReorderImports() throws IOException { checkRunsThenUpToDate(); replace("build.gradle", - "googleJavaFormat('1.17.0')", - "googleJavaFormat()"); + "googleJavaFormat('1.27.0')", + "googleJavaFormat('1.28.0')"); checkRunsThenUpToDate(); } @@ -83,7 +83,7 @@ void integrationWithSkipJavadocFormatting() throws IOException { "spotless {", " java {", " target file('test.java')", - " googleJavaFormat('1.17.0').skipJavadocFormatting()", + " googleJavaFormat('1.27.0').skipJavadocFormatting()", " }", "}"); @@ -93,8 +93,8 @@ void integrationWithSkipJavadocFormatting() throws IOException { checkRunsThenUpToDate(); replace("build.gradle", - "googleJavaFormat('1.17.0')", - "googleJavaFormat()"); + "googleJavaFormat('1.27.0')", + "googleJavaFormat('1.28.0')"); checkRunsThenUpToDate(); } } diff --git a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GradleIntegrationHarness.java b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GradleIntegrationHarness.java index 9e1738a02e..f84ba844dc 100644 --- a/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GradleIntegrationHarness.java +++ b/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GradleIntegrationHarness.java @@ -57,8 +57,11 @@ public enum GradleVersionSupport { GradleVersionSupport(String version) { String minVersionForRunningJRE; switch (Jvm.version()) { + case 26: + throw new UnsupportedOperationException("TODO: gradle compat for " + Jvm.version() + " https://docs.gradle.org/current/userguide/compatibility.html"); case 25: - // TODO: https://docs.gradle.org/current/userguide/compatibility.html + minVersionForRunningJRE = "9.1.0"; + break; case 24: minVersionForRunningJRE = "8.14"; break; diff --git a/testlib/src/test/java/com/diffplug/spotless/java/PalantirJavaFormatStepTest.java b/testlib/src/test/java/com/diffplug/spotless/java/PalantirJavaFormatStepTest.java index 642341cbc0..ddc776fbf1 100644 --- a/testlib/src/test/java/com/diffplug/spotless/java/PalantirJavaFormatStepTest.java +++ b/testlib/src/test/java/com/diffplug/spotless/java/PalantirJavaFormatStepTest.java @@ -52,7 +52,7 @@ void behavior() throws Exception { @Test void formatJavadoc() throws Exception { - FormatterStep step = PalantirJavaFormatStep.create("2.57.0", "PALANTIR", true, TestProvisioner.mavenCentral()); + FormatterStep step = PalantirJavaFormatStep.create("2.71.0", "PALANTIR", true, TestProvisioner.mavenCentral()); StepHarness.forStep(step) .testResource("java/palantirjavaformat/JavaCodeWithJavaDocUnformatted.test", "java/palantirjavaformat/JavaCodeWithJavaDocFormatted.test") .testResource("java/palantirjavaformat/JavaCodeWithPackageUnformatted.test", "java/palantirjavaformat/JavaCodeWithPackageFormatted.test"); diff --git a/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java b/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java index 0d520b8b0c..9b74c9e84c 100644 --- a/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java +++ b/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java @@ -23,8 +23,12 @@ import com.diffplug.spotless.StepHarnessWithFile; import com.diffplug.spotless.TestProvisioner; +import org.junit.jupiter.api.condition.DisabledOnJre; +import org.junit.jupiter.api.condition.JRE; + class KtLintStepTest extends ResourceHarness { @Test + @DisabledOnJre(JRE.JAVA_25) void works0_48_0() { FormatterStep step = KtLintStep.create("0.48.0", TestProvisioner.mavenCentral()); StepHarnessWithFile.forStep(this, step) @@ -33,6 +37,7 @@ void works0_48_0() { } @Test + @DisabledOnJre(JRE.JAVA_25) void works0_48_1() { FormatterStep step = KtLintStep.create("0.48.1", TestProvisioner.mavenCentral()); StepHarnessWithFile.forStep(this, step) @@ -41,6 +46,7 @@ void works0_48_1() { } @Test + @DisabledOnJre(JRE.JAVA_25) void works0_49_0() { FormatterStep step = KtLintStep.create("0.49.0", TestProvisioner.mavenCentral()); StepHarnessWithFile.forStep(this, step) @@ -49,6 +55,7 @@ void works0_49_0() { } @Test + @DisabledOnJre(JRE.JAVA_25) void works0_49_1() { FormatterStep step = KtLintStep.create("0.49.1", TestProvisioner.mavenCentral()); StepHarnessWithFile.forStep(this, step) @@ -57,6 +64,7 @@ void works0_49_1() { } @Test + @DisabledOnJre(JRE.JAVA_25) void works0_50_0() { FormatterStep step = KtLintStep.create("0.50.0", TestProvisioner.mavenCentral()); StepHarnessWithFile.forStep(this, step) diff --git a/testlib/src/test/java/com/diffplug/spotless/kotlin/KtfmtStepTest.java b/testlib/src/test/java/com/diffplug/spotless/kotlin/KtfmtStepTest.java index 49f9a5e884..324f36e44d 100644 --- a/testlib/src/test/java/com/diffplug/spotless/kotlin/KtfmtStepTest.java +++ b/testlib/src/test/java/com/diffplug/spotless/kotlin/KtfmtStepTest.java @@ -21,6 +21,9 @@ import com.diffplug.spotless.*; +import org.junit.jupiter.api.condition.DisabledOnJre; +import org.junit.jupiter.api.condition.JRE; + class KtfmtStepTest extends ResourceHarness { @Test void behavior() throws Exception { @@ -37,6 +40,7 @@ void behaviorWithOptions() { } @Test + @DisabledOnJre(JRE.JAVA_25) void dropboxStyle_0_16() throws Exception { KtfmtStep.KtfmtFormattingOptions options = new KtfmtStep.KtfmtFormattingOptions(); FormatterStep step = KtfmtStep.create("0.16", TestProvisioner.mavenCentral(), KtfmtStep.Style.DROPBOX, options); @@ -44,6 +48,7 @@ void dropboxStyle_0_16() throws Exception { } @Test + @DisabledOnJre(JRE.JAVA_25) void dropboxStyle_0_18() throws Exception { KtfmtStep.KtfmtFormattingOptions options = new KtfmtStep.KtfmtFormattingOptions(); FormatterStep step = KtfmtStep.create("0.18", TestProvisioner.mavenCentral(), KtfmtStep.Style.DROPBOX, options); @@ -51,6 +56,7 @@ void dropboxStyle_0_18() throws Exception { } @Test + @DisabledOnJre(JRE.JAVA_25) void dropboxStyle_0_22() throws Exception { KtfmtStep.KtfmtFormattingOptions options = new KtfmtStep.KtfmtFormattingOptions(); FormatterStep step = KtfmtStep.create("0.22", TestProvisioner.mavenCentral(), KtfmtStep.Style.DROPBOX, options);