@@ -194,6 +194,7 @@ private void validate() throws IOException {
194
194
throw new IllegalArgumentException ("First match w3c capabilities is zero length" );
195
195
}
196
196
197
+ //noinspection ResultOfMethodCallIgnored
197
198
firsts .stream ()
198
199
.peek (map -> {
199
200
Set <String > overlap = Sets .intersection (always .keySet (), map .keySet ());
@@ -256,14 +257,12 @@ public void writeTo(Appendable appendable) throws IOException {
256
257
json .name (CAPABILITIES );
257
258
json .beginObject ();
258
259
259
- json . name ( ALWAYS_MATCH );
260
- getW3C (). forEach ( json :: write );
261
-
260
+ // Then write everything into the w3c payload. Because of the way we do this, it's easiest
261
+ // to just populate the "firstMatch" section. The spec says it's fine to omit the
262
+ // "alwaysMatch" field, so we do this.
262
263
json .name (FIRST_MATCH );
263
264
json .beginArray ();
264
- //noinspection unchecked
265
- json .beginObject ();
266
- json .endObject ();
265
+ getW3C ().forEach (json ::write );
267
266
json .endArray ();
268
267
269
268
json .endObject (); // Close "capabilities" object
@@ -291,7 +290,7 @@ private void writeMetaData(JsonOutput out) throws IOException {
291
290
292
291
default :
293
292
out .name (name );
294
- out .write (input .< Object > read (Object .class ));
293
+ out .write (input .read (Object .class ));
295
294
break ;
296
295
}
297
296
}
@@ -437,8 +436,7 @@ public Object setValue(Object value) {
437
436
return null ;
438
437
}
439
438
440
- Map <String , Object > toReturn = new TreeMap <>();
441
- toReturn .putAll (capabilities );
439
+ Map <String , Object > toReturn = new TreeMap <>(capabilities );
442
440
443
441
// Platform name
444
442
if (capabilities .containsKey (PLATFORM ) && !capabilities .containsKey (PLATFORM_NAME )) {
0 commit comments