diff --git a/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java b/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java index f968d2a9..8d2fd487 100644 --- a/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java +++ b/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java @@ -196,7 +196,7 @@ final class DefaultTypeAdapters { return map; } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) private static JsonDeserializer wrapDeserializer(JsonDeserializer deserializer) { return new JsonDeserializerExceptionWrapper(deserializer); } @@ -569,7 +569,7 @@ final class DefaultTypeAdapters { } } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) static class MapTypeAdapter implements JsonSerializer, JsonDeserializer, InstanceCreator { diff --git a/gson/src/main/java/com/google/gson/FieldNamingStrategy2Adapter.java b/gson/src/main/java/com/google/gson/FieldNamingStrategy2Adapter.java index a1a0c8c2..faeee2f2 100644 --- a/gson/src/main/java/com/google/gson/FieldNamingStrategy2Adapter.java +++ b/gson/src/main/java/com/google/gson/FieldNamingStrategy2Adapter.java @@ -31,6 +31,7 @@ final class FieldNamingStrategy2Adapter implements FieldNamingStrategy2 { this.adaptee = adaptee; } + @SuppressWarnings("deprecation") public String translateName(FieldAttributes f) { return adaptee.translateName(f.getFieldObject()); } diff --git a/gson/src/main/java/com/google/gson/JsonSerializationVisitor.java b/gson/src/main/java/com/google/gson/JsonSerializationVisitor.java index 04567590..49d3e0c8 100644 --- a/gson/src/main/java/com/google/gson/JsonSerializationVisitor.java +++ b/gson/src/main/java/com/google/gson/JsonSerializationVisitor.java @@ -172,7 +172,7 @@ final class JsonSerializationVisitor implements ObjectNavigator.Visitor { /** * objTypePair.getObject() must not be null */ - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) private JsonElement findAndInvokeCustomSerializer(ObjectTypePair objTypePair) { Pair,ObjectTypePair> pair = objTypePair.getMatchingHandler(serializers); if (pair == null) { diff --git a/gson/src/main/java/com/google/gson/ParameterizedTypeHandlerMap.java b/gson/src/main/java/com/google/gson/ParameterizedTypeHandlerMap.java index 2f67a7a5..db9f0b7d 100644 --- a/gson/src/main/java/com/google/gson/ParameterizedTypeHandlerMap.java +++ b/gson/src/main/java/com/google/gson/ParameterizedTypeHandlerMap.java @@ -133,7 +133,6 @@ final class ParameterizedTypeHandlerMap { return handler; } - @SuppressWarnings("unchecked") private T getHandlerForTypeHierarchy(Class type) { for (Pair, T> entry : typeHierarchyList) { if (entry.first.isAssignableFrom(type)) { diff --git a/gson/src/test/java/com/google/gson/DefaultMapJsonSerializerTest.java b/gson/src/test/java/com/google/gson/DefaultMapJsonSerializerTest.java index 99f06c55..91461588 100644 --- a/gson/src/test/java/com/google/gson/DefaultMapJsonSerializerTest.java +++ b/gson/src/test/java/com/google/gson/DefaultMapJsonSerializerTest.java @@ -32,7 +32,7 @@ import java.util.Map; */ public class DefaultMapJsonSerializerTest extends TestCase { - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") private JsonSerializer mapSerializer; @Override diff --git a/gson/src/test/java/com/google/gson/JsonObjectTest.java b/gson/src/test/java/com/google/gson/JsonObjectTest.java index 36e5402e..7ab8b8c5 100644 --- a/gson/src/test/java/com/google/gson/JsonObjectTest.java +++ b/gson/src/test/java/com/google/gson/JsonObjectTest.java @@ -18,9 +18,6 @@ package com.google.gson; import junit.framework.TestCase; -import java.util.HashMap; -import java.util.Map; - /** * Unit test for the {@link JsonObject} class. * diff --git a/gson/src/test/java/com/google/gson/ParamterizedTypeFixtures.java b/gson/src/test/java/com/google/gson/ParamterizedTypeFixtures.java index 418555c0..897cc7c2 100644 --- a/gson/src/test/java/com/google/gson/ParamterizedTypeFixtures.java +++ b/gson/src/test/java/com/google/gson/ParamterizedTypeFixtures.java @@ -75,7 +75,7 @@ public class ParamterizedTypeFixtures { public int hashCode() { return value == null ? 0 : value.hashCode(); } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") @Override public boolean equals(Object obj) { if (this == obj) { diff --git a/gson/src/test/java/com/google/gson/functional/DefaultTypeAdaptersTest.java b/gson/src/test/java/com/google/gson/functional/DefaultTypeAdaptersTest.java index a829a176..89d8ad38 100644 --- a/gson/src/test/java/com/google/gson/functional/DefaultTypeAdaptersTest.java +++ b/gson/src/test/java/com/google/gson/functional/DefaultTypeAdaptersTest.java @@ -357,7 +357,6 @@ public class DefaultTypeAdaptersTest extends TestCase { assertEquals(now.getDay(), extracted.getDay()); } - @SuppressWarnings("deprecation") public void testDateSerializationWithPatternNotOverridenByTypeAdapter() throws Exception { String pattern = "yyyy-MM-dd"; DateFormat formatter = new SimpleDateFormat(pattern); diff --git a/gson/src/test/java/com/google/gson/functional/MapTest.java b/gson/src/test/java/com/google/gson/functional/MapTest.java index a22850b1..7e76feab 100755 --- a/gson/src/test/java/com/google/gson/functional/MapTest.java +++ b/gson/src/test/java/com/google/gson/functional/MapTest.java @@ -63,7 +63,7 @@ public class MapTest extends TestCase { assertEquals(2, target.get("b").intValue()); } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) public void testRawMapSerialization() { Map map = new LinkedHashMap(); map.put("a", 1); @@ -154,7 +154,7 @@ public class MapTest extends TestCase { assertTrue(json.contains("\"a\":\"b\"")); } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public void testParameterizedMapSubclassDeserialization() { Type type = new TypeToken>() {}.getType(); Gson gson = new GsonBuilder().registerTypeAdapter(type, diff --git a/gson/src/test/java/com/google/gson/functional/ObjectTest.java b/gson/src/test/java/com/google/gson/functional/ObjectTest.java index da5de99d..0a2f3a30 100644 --- a/gson/src/test/java/com/google/gson/functional/ObjectTest.java +++ b/gson/src/test/java/com/google/gson/functional/ObjectTest.java @@ -96,14 +96,14 @@ public class ObjectTest extends TestCase { assertEquals(target.getExpectedJson(), gson.toJson(target)); } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public void testClassWithTransientFieldsDeserialization() throws Exception { String json = "{\"longValue\":[1]}"; ClassWithTransientFields target = gson.fromJson(json, ClassWithTransientFields.class); assertEquals(json, target.getExpectedJson()); } - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public void testClassWithTransientFieldsDeserializationTransientFieldsPassedInJsonAreIgnored() throws Exception { String json = "{\"transientLongValue\":1,\"longValue\":[1]}";