diff --git a/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java b/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java index 6699664c..f968d2a9 100644 --- a/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java +++ b/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java @@ -62,7 +62,7 @@ final class DefaultTypeAdapters { private static final DefaultTimestampDeserializer TIMESTAMP_DESERIALIZER = new DefaultTimestampDeserializer(); - @SuppressWarnings("unchecked") + @SuppressWarnings({ "rawtypes" }) private static final EnumTypeAdapter ENUM_TYPE_ADAPTER = new EnumTypeAdapter(); private static final UrlTypeAdapter URL_TYPE_ADAPTER = new UrlTypeAdapter(); private static final UriTypeAdapter URI_TYPE_ADAPTER = new UriTypeAdapter(); @@ -506,7 +506,7 @@ final class DefaultTypeAdapters { } } - @SuppressWarnings({ "unchecked" }) + @SuppressWarnings({ "unchecked", "rawtypes" }) private static class CollectionTypeAdapter implements JsonSerializer, JsonDeserializer, InstanceCreator { public JsonElement serialize(Collection src, Type typeOfSrc, JsonSerializationContext context) { diff --git a/gson/src/test/java/com/google/gson/functional/CollectionTest.java b/gson/src/test/java/com/google/gson/functional/CollectionTest.java index 9889c050..46ffe4be 100644 --- a/gson/src/test/java/com/google/gson/functional/CollectionTest.java +++ b/gson/src/test/java/com/google/gson/functional/CollectionTest.java @@ -201,7 +201,7 @@ public class CollectionTest extends TestCase { assertEquals("[1,2,3,4,5,6,7,8,9]", gson.toJson(target)); } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "rawtypes" }) public void testRawCollectionSerialization() { BagOfPrimitives bag1 = new BagOfPrimitives(); Collection target = Arrays.asList(bag1, bag1); @@ -223,7 +223,7 @@ public class CollectionTest extends TestCase { } catch (JsonParseException expected) { } } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public void testRawCollectionOfBagOfPrimitivesNotAllowed() { try { BagOfPrimitives bag = new BagOfPrimitives(10, 20, false, "stringValue"); @@ -276,7 +276,7 @@ public class CollectionTest extends TestCase { assertTrue(deserializedCollection.contains(objB)); } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "rawtypes" }) private static int[] toIntArray(Collection collection) { int[] ints = new int[collection.size()]; int i = 0; diff --git a/gson/src/test/java/com/google/gson/functional/PrintFormattingTest.java b/gson/src/test/java/com/google/gson/functional/PrintFormattingTest.java index 757037b3..c95a5d3e 100644 --- a/gson/src/test/java/com/google/gson/functional/PrintFormattingTest.java +++ b/gson/src/test/java/com/google/gson/functional/PrintFormattingTest.java @@ -45,7 +45,7 @@ public class PrintFormattingTest extends TestCase { gson = new Gson(); } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public void testCompactFormattingLeavesNoWhiteSpace() { List list = new ArrayList(); list.add(new BagOfPrimitives());