Skip to content

Commit aa0c878

Browse files
committed
Fix spotbugs warning.
1 parent 86c613b commit aa0c878

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.concurrent.Future;
3232
import java.util.function.BiConsumer;
3333

34+
import edu.umd.cs.findbugs.annotations.Nullable;
3435
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
3536

3637
/**
@@ -62,7 +63,7 @@ public Result shellWinUnix(String cmdWin, String cmdUnix) throws IOException, In
6263
}
6364

6465
/** Executes the given shell command (using {@code cmd} on windows and {@code sh} on unix). */
65-
public Result shellWinUnix(File cwd, Map<String, String> environment, String cmdWin, String cmdUnix) throws IOException, InterruptedException {
66+
public Result shellWinUnix(@Nullable File cwd, @Nullable Map<String, String> environment, String cmdWin, String cmdUnix) throws IOException, InterruptedException {
6667
List<String> args;
6768
if (FileSignature.machineIsWin()) {
6869
args = Arrays.asList("cmd", "/c", cmdWin);
@@ -78,7 +79,7 @@ public Result exec(String... args) throws IOException, InterruptedException {
7879
}
7980

8081
/** Creates a process with the given arguments, the given byte array is written to stdin immediately. */
81-
public Result exec(byte[] stdin, String... args) throws IOException, InterruptedException {
82+
public Result exec(@Nullable byte[] stdin, String... args) throws IOException, InterruptedException {
8283
return exec(stdin, Arrays.asList(args));
8384
}
8485

@@ -88,12 +89,12 @@ public Result exec(List<String> args) throws IOException, InterruptedException {
8889
}
8990

9091
/** Creates a process with the given arguments, the given byte array is written to stdin immediately. */
91-
public Result exec(byte[] stdin, List<String> args) throws IOException, InterruptedException {
92+
public Result exec(@Nullable byte[] stdin, List<String> args) throws IOException, InterruptedException {
9293
return exec(null, null, stdin, args);
9394
}
9495

9596
/** Creates a process with the given arguments, the given byte array is written to stdin immediately. */
96-
public Result exec(File cwd, Map<String, String> environment, byte[] stdin, List<String> args) throws IOException, InterruptedException {
97+
public Result exec(@Nullable File cwd, @Nullable Map<String, String> environment, @Nullable byte[] stdin, List<String> args) throws IOException, InterruptedException {
9798
ProcessBuilder builder = new ProcessBuilder(args);
9899
if (cwd != null) {
99100
builder.directory(cwd);

0 commit comments

Comments
 (0)