@@ -113,10 +113,11 @@ public static PluginConfig load(@NotNull VirtualFile file) {
113
113
final Computable <PluginConfig > readAction = () -> {
114
114
try (
115
115
// Create the input stream in a try-with-resources statement. This will automatically close the stream
116
- // in an implicit finally section; this addresses a file handle leak issue we had on MacOS .
116
+ // in an implicit finally section; this addresses a file handle leak issue we had on macOS .
117
117
final InputStreamReader input = new InputStreamReader (file .getInputStream (), StandardCharsets .UTF_8 )
118
118
) {
119
119
final Fields fields = GSON .fromJson (input , Fields .class );
120
+ assert fields != null ;
120
121
return new PluginConfig (fields );
121
122
}
122
123
catch (FileNotFoundException e ) {
@@ -142,7 +143,7 @@ public static PluginConfig load(@NotNull VirtualFile file) {
142
143
}
143
144
144
145
@ VisibleForTesting
145
- public static PluginConfig forTest (
146
+ public static @ NotNull PluginConfig forTest (
146
147
@ Nullable String daemonScript ,
147
148
@ Nullable String devToolsScript ,
148
149
@ Nullable String doctorScript ,
@@ -181,86 +182,86 @@ private static class Fields {
181
182
* The script to run to start 'flutter daemon'.
182
183
*/
183
184
@ SerializedName ("daemonScript" )
184
- private String daemonScript ;
185
+ private @ Nullable String daemonScript ;
185
186
186
187
@ SerializedName ("devToolsScript" )
187
- private String devToolsScript ;
188
+ private @ Nullable String devToolsScript ;
188
189
189
190
/**
190
191
* The script to run to start 'flutter doctor'.
191
192
*/
192
193
@ SerializedName ("doctorScript" )
193
- private String doctorScript ;
194
+ private @ Nullable String doctorScript ;
194
195
195
196
/**
196
197
* The script to run to start 'flutter test'
197
198
*/
198
199
@ SerializedName ("testScript" )
199
- private String testScript ;
200
+ private @ Nullable String testScript ;
200
201
201
202
/**
202
203
* The script to run to start 'flutter run'
203
204
*/
204
205
@ SerializedName ("runScript" )
205
- private String runScript ;
206
+ private @ Nullable String runScript ;
206
207
207
208
/**
208
209
* The script to run to start 'flutter sync'
209
210
*/
210
211
@ SerializedName ("syncScript" )
211
- private String syncScript ;
212
+ private @ Nullable String syncScript ;
212
213
213
214
@ SerializedName ("toolsScript" )
214
- private String toolsScript ;
215
+ private @ Nullable String toolsScript ;
215
216
216
217
/**
217
218
* The directory containing the SDK tools.
218
219
*/
219
220
@ SerializedName ("sdkHome" )
220
- private String sdkHome ;
221
+ private @ Nullable String sdkHome ;
221
222
222
223
/**
223
224
* The file containing the Flutter version.
224
225
*/
225
226
@ SerializedName ("requiredIJPluginID" )
226
- private String requiredIJPluginID ;
227
+ private @ Nullable String requiredIJPluginID ;
227
228
228
229
/**
229
230
* The file containing the message to install the required IJ Plugin.
230
231
*/
231
232
@ SerializedName ("requiredIJPluginMessage" )
232
- private String requiredIJPluginMessage ;
233
+ private @ Nullable String requiredIJPluginMessage ;
233
234
234
235
/**
235
236
* The prefix that indicates a configuration warning message.
236
237
*/
237
238
@ SerializedName ("configWarningPrefix" )
238
- private String configWarningPrefix ;
239
+ private @ Nullable String configWarningPrefix ;
239
240
240
241
/**
241
242
* The prefix that indicates a message about iOS run being updated.
242
243
*/
243
244
@ SerializedName ("updatedIosRunMessage" )
244
- private String updatedIosRunMessage ;
245
+ private @ Nullable String updatedIosRunMessage ;
245
246
246
247
Fields () {
247
248
}
248
249
249
250
/**
250
251
* Convenience constructor that takes all parameters.
251
252
*/
252
- Fields (String daemonScript ,
253
- String devToolsScript ,
254
- String doctorScript ,
255
- String testScript ,
256
- String runScript ,
257
- String syncScript ,
258
- String toolsScript ,
259
- String sdkHome ,
260
- String requiredIJPluginID ,
261
- String requiredIJPluginMessage ,
262
- String configWarningPrefix ,
263
- String updatedIosRunMessage ) {
253
+ Fields (@ Nullable String daemonScript ,
254
+ @ Nullable String devToolsScript ,
255
+ @ Nullable String doctorScript ,
256
+ @ Nullable String testScript ,
257
+ @ Nullable String runScript ,
258
+ @ Nullable String syncScript ,
259
+ @ Nullable String toolsScript ,
260
+ @ Nullable String sdkHome ,
261
+ @ Nullable String requiredIJPluginID ,
262
+ @ Nullable String requiredIJPluginMessage ,
263
+ @ Nullable String configWarningPrefix ,
264
+ @ Nullable String updatedIosRunMessage ) {
264
265
this .daemonScript = daemonScript ;
265
266
this .devToolsScript = devToolsScript ;
266
267
this .doctorScript = doctorScript ;
@@ -298,6 +299,6 @@ public int hashCode() {
298
299
}
299
300
}
300
301
301
- private static final Gson GSON = new Gson ();
302
+ private static final @ NotNull Gson GSON = new Gson ();
302
303
private static final @ NotNull Logger LOG = Logger .getInstance (PluginConfig .class );
303
304
}
0 commit comments