Skip to content

Commit 3e19dc8

Browse files
committed
Read Signature.bundled instead of suppressing UnusedVariable
The 21.X.X merge brought in Signature, whose bundled field only went into the serialized signature and carried a suppression. jars() now picks the jars by it: the hash is there exactly when the build declared none of its own, so the step formats with the same jars as before.
1 parent 5349e35 commit 3e19dc8

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎gradle-open-java-format/src/main/java/com/palantir/javaformat/gradle/spotless/PalantirJavaFormatStep.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ Signature sign() throws IOException {
8484
static final class Signature implements Serializable {
8585
private static final long serialVersionUID = 1L;
8686

87-
// Spotless compares the signature in its serialized form, and reads nothing out of it.
88-
@SuppressWarnings("UnusedVariable")
87+
/** The hash of the plugin's own jars, or empty when the build declared its own. */
8988
private final String bundled;
9089

9190
private final FileSignature override;
@@ -100,7 +99,7 @@ static final class Signature implements Serializable {
10099
}
101100

102101
List<File> jars() {
103-
return BundledFormatter.jarsUnlessOverridden(override.files(), gradleUserHome);
102+
return bundled.isEmpty() ? List.copyOf(override.files()) : BundledFormatter.jars(gradleUserHome);
104103
}
105104
}
106105

0 commit comments

Comments
 (0)