From d46792a791ee4bae62791f4267cc28cd566058d2 Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Thu, 16 Oct 2025 09:28:38 +0200 Subject: [PATCH 1/2] Get rid of Java-specific default Palantir version Even the newest Palantir Java Formatter is compatible with Java 11+. See also https://github.com/diffplug/spotless/issues/2451#issuecomment-3407803705. This closes #2685 --- .../com/diffplug/spotless/java/PalantirJavaFormatStep.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/src/main/java/com/diffplug/spotless/java/PalantirJavaFormatStep.java b/lib/src/main/java/com/diffplug/spotless/java/PalantirJavaFormatStep.java index b717787d86..f51e0356d0 100644 --- a/lib/src/main/java/com/diffplug/spotless/java/PalantirJavaFormatStep.java +++ b/lib/src/main/java/com/diffplug/spotless/java/PalantirJavaFormatStep.java @@ -23,7 +23,6 @@ import com.diffplug.spotless.FormatterFunc; import com.diffplug.spotless.FormatterStep; import com.diffplug.spotless.JarState; -import com.diffplug.spotless.Jvm; import com.diffplug.spotless.Provisioner; /** Wraps up palantir-java-format fork of @@ -35,7 +34,7 @@ public final class PalantirJavaFormatStep implements Serializable { private static final String DEFAULT_STYLE = "PALANTIR"; private static final String NAME = "palantir-java-format"; public static final String MAVEN_COORDINATE = "com.palantir.javaformat:palantir-java-format:"; - private static final Jvm.Support JVM_SUPPORT = Jvm. support(NAME).add(8, "1.1.0").add(11, "2.28.0").add(21, "2.71.0"); + public static final String DEFAULT_VERSION = "2.80.0"; // compatible with Java 11+ /** The jar that contains the formatter. */ private final JarState.Promised jarState; @@ -90,7 +89,7 @@ public static FormatterStep create(String version, String style, boolean formatJ /** Get default formatter version */ public static String defaultVersion() { - return JVM_SUPPORT.getRecommendedFormatterVersion(); + return DEFAULT_VERSION; } /** Get default style */ @@ -129,7 +128,7 @@ FormatterFunc createFormat() throws Exception { final Class formatterFunc = classLoader.loadClass("com.diffplug.spotless.glue.pjf.PalantirJavaFormatFormatterFunc"); // 1st arg is "style", 2nd arg is "formatJavadoc" final Constructor constructor = formatterFunc.getConstructor(String.class, boolean.class); - return JVM_SUPPORT.suggestLaterVersionOnError(formatterVersion, (FormatterFunc) constructor.newInstance(style, formatJavadoc)); + return (FormatterFunc) constructor.newInstance(style, formatJavadoc); } } } From 564353ebe2c1b8b2c0d1bc283678cee16eee2064 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Thu, 16 Oct 2025 09:46:20 -0700 Subject: [PATCH 2/2] Update changelogs. --- CHANGES.md | 2 ++ plugin-gradle/CHANGES.md | 2 ++ plugin-maven/CHANGES.md | 2 ++ 3 files changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index ad8f0e0bad..b3fc00ed35 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] +### Fixed +- palantirJavaFormat is no longer arbitrarily set to outdated versions on Java 17, latest available version is always used ([#2686](https://github.com/diffplug/spotless/pull/2686) fixes [#2685](https://github.com/diffplug/spotless/issues/2685)) ## [4.0.0] - 2025-09-24 ### Changes diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index efe193a3b4..d2eb548268 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -3,6 +3,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`). ## [Unreleased] +### Fixed +- palantirJavaFormat is no longer arbitrarily set to outdated versions on Java 17, latest available version is always used ([#2686](https://github.com/diffplug/spotless/pull/2686) fixes [#2685](https://github.com/diffplug/spotless/issues/2685)) ## [8.0.0] - 2025-09-24 ### Changed diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index 1100a48c06..8a49b4f2ce 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -3,6 +3,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Fixed +- palantirJavaFormat is no longer arbitrarily set to outdated versions on Java 17, latest available version is always used ([#2686](https://github.com/diffplug/spotless/pull/2686) fixes [#2685](https://github.com/diffplug/spotless/issues/2685)) ## [3.0.0] - 2025-09-24 ### Changes