Skip to content

Commit 9578583

Browse files
Small tweaks to fix Error Prone warnings. (#2227)
* Small tweaks to fix Error Prone warnings. * Add another suppression.
1 parent 66d9621 commit 9578583

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

gson/src/main/java/com/google/gson/internal/bind/JsonTreeReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ JsonElement nextJsonElement() throws IOException {
277277
JsonToken peeked = peek();
278278
switch (peeked) {
279279
case NAME:
280-
nextName(true);
280+
String unused = nextName(true);
281281
break;
282282
case END_ARRAY:
283283
endArray();

gson/src/test/java/com/google/gson/JsonArrayAsListTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public void testContains() {
210210
assertFalse(list.contains(new JsonPrimitive(2)));
211211
assertFalse(list.contains(null));
212212

213-
@SuppressWarnings("unlikely-arg-type")
213+
@SuppressWarnings({"unlikely-arg-type", "CollectionIncompatibleType"})
214214
boolean containsInt = list.contains(1); // should only contain JsonPrimitive(1)
215215
assertFalse(containsInt);
216216
}
@@ -227,7 +227,7 @@ public void testIndexOf() {
227227
assertEquals(-1, list.indexOf(new JsonPrimitive(2)));
228228
assertEquals(-1, list.indexOf(null));
229229

230-
@SuppressWarnings("unlikely-arg-type")
230+
@SuppressWarnings({"unlikely-arg-type", "CollectionIncompatibleType"})
231231
int indexOfInt = list.indexOf(1); // should only contain JsonPrimitive(1)
232232
assertEquals(-1, indexOfInt);
233233

gson/src/test/java/com/google/gson/JsonObjectAsMapTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void testContainsValue() {
5959
assertFalse(map.containsValue(new JsonPrimitive(2)));
6060
assertFalse(map.containsValue(null));
6161

62-
@SuppressWarnings("unlikely-arg-type")
62+
@SuppressWarnings({"unlikely-arg-type", "CollectionIncompatibleType"})
6363
boolean containsInt = map.containsValue(1); // should only contain JsonPrimitive(1)
6464
assertFalse(containsInt);
6565
}

0 commit comments

Comments
 (0)