@@ -64,11 +64,11 @@ public FormatterStep create() {
64
64
65
65
private State createState () {
66
66
String instructions = "https://docs.buf.build/installation" ;
67
- ForeignExe exeAbsPath = ForeignExe .nameAndVersion ("buf" , version )
67
+ ForeignExe exe = ForeignExe .nameAndVersion ("buf" , version )
68
68
.pathToExe (pathToExe )
69
69
.versionRegex (Pattern .compile ("(\\ S*)" ))
70
70
.fixCantFind ("Try following the instructions at " + instructions + ", or else tell Spotless where it is with {@code buf().pathToExe('path/to/executable')}" );
71
- return new State (this , exeAbsPath );
71
+ return new State (this , exe );
72
72
}
73
73
74
74
@ SuppressFBWarnings ("SE_TRANSIENT_FIELD_NOT_RESTORED" )
@@ -77,22 +77,21 @@ static class State implements Serializable {
77
77
// used for up-to-date checks and caching
78
78
final String version ;
79
79
final transient ForeignExe exe ;
80
- // used for executing
81
- private transient @ Nullable List <String > args ;
82
80
83
- State (BufStep step , ForeignExe exeAbsPath ) {
81
+ State (BufStep step , ForeignExe exe ) {
84
82
this .version = step .version ;
85
- this .exe = Objects .requireNonNull (exeAbsPath );
83
+ this .exe = Objects .requireNonNull (exe );
86
84
}
87
85
88
86
String format (ProcessRunner runner , String input , File file ) throws IOException , InterruptedException {
89
- if (args == null ) {
90
- args = Arrays .asList (
91
- exe .confirmVersionAndGetAbsolutePath (),
92
- "format" ,
93
- file .getAbsolutePath ());
94
- }
95
- return runner .exec (input .getBytes (StandardCharsets .UTF_8 ), args ).assertExitZero (StandardCharsets .UTF_8 );
87
+ return runner .exec (
88
+ input .getBytes (StandardCharsets .UTF_8 ),
89
+ List .of (
90
+ exe .confirmVersionAndGetAbsolutePath (),
91
+ "format" ,
92
+ file .getAbsolutePath ()
93
+ )
94
+ ).assertExitZero (StandardCharsets .UTF_8 );
96
95
}
97
96
98
97
FormatterFunc .Closeable toFunc () {
0 commit comments