Skip to content

Commit ab1452d

Browse files
committed
Streamline the FileSignature api.
1 parent 55481fa commit ab1452d

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

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

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,26 +121,10 @@ public static Promised promise(Iterable<File> files) {
121121
return new Promised(MoreIterables.toNullHostileList(files), null);
122122
}
123123

124-
public Promised roundTrippable() {
124+
public Promised asPromise() {
125125
return new Promised(files, this);
126126
}
127127

128-
public static @Nullable Promised roundTrippableNullable(@Nullable FileSignature signature) {
129-
if (signature != null) {
130-
return signature.roundTrippable();
131-
} else {
132-
return null;
133-
}
134-
}
135-
136-
public static @Nullable FileSignature stripAbsolutePathsNullable(@Nullable Promised roundTrippable) throws IOException {
137-
if (roundTrippable != null) {
138-
return roundTrippable.get();
139-
} else {
140-
return null;
141-
}
142-
}
143-
144128
/** Returns all of the files in this signature, throwing an exception if there are more or less than 1 file. */
145129
public Collection<File> files() {
146130
return Collections.unmodifiableList(files);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public JarState get() {
5151
try {
5252
if (cached == null) {
5353
JarState result = supplier.get();
54-
cached = result.fileSignature.roundTrippable();
54+
cached = result.fileSignature.asPromise();
5555
return result;
5656
}
5757
return new JarState(cached.get());

lib/src/main/java/com/diffplug/spotless/kotlin/DiktatStep.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class DiktatStep implements Serializable {
3434
private DiktatStep(JarState.Promised jarState, boolean isScript, @Nullable FileSignature config) {
3535
this.jarState = jarState;
3636
this.isScript = isScript;
37-
this.config = FileSignature.roundTrippableNullable(config);
37+
this.config = config != null ? config.asPromise() : null;
3838
}
3939

4040
private static final String MIN_SUPPORTED_VERSION = "1.2.1";
@@ -72,7 +72,7 @@ public static FormatterStep create(String versionDiktat, Provisioner provisioner
7272
}
7373

7474
private State equalityState() throws Exception {
75-
return new State(jarState.get(), isScript, FileSignature.stripAbsolutePathsNullable(config));
75+
return new State(jarState.get(), isScript, config != null ? config.get() : null);
7676
}
7777

7878
static final class State implements Serializable {

0 commit comments

Comments
 (0)