replaced unchecked suppressed warnings token with more specific rawtypes.
removed unused imports.
This commit is contained in:
parent
ed838ec104
commit
de0f8da151
@ -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<Map>, JsonDeserializer<Map>,
|
||||
InstanceCreator<Map> {
|
||||
|
||||
|
@ -31,6 +31,7 @@ final class FieldNamingStrategy2Adapter implements FieldNamingStrategy2 {
|
||||
this.adaptee = adaptee;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public String translateName(FieldAttributes f) {
|
||||
return adaptee.translateName(f.getFieldObject());
|
||||
}
|
||||
|
@ -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<JsonSerializer<?>,ObjectTypePair> pair = objTypePair.getMatchingHandler(serializers);
|
||||
if (pair == null) {
|
||||
|
@ -133,7 +133,6 @@ final class ParameterizedTypeHandlerMap<T> {
|
||||
return handler;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private T getHandlerForTypeHierarchy(Class<?> type) {
|
||||
for (Pair<Class<?>, T> entry : typeHierarchyList) {
|
||||
if (entry.first.isAssignableFrom(type)) {
|
||||
|
@ -32,7 +32,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class DefaultMapJsonSerializerTest extends TestCase {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JsonSerializer<Map> mapSerializer;
|
||||
|
||||
@Override
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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<MyParameterizedMap<String, Integer>>() {}.getType();
|
||||
Gson gson = new GsonBuilder().registerTypeAdapter(type,
|
||||
|
@ -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]}";
|
||||
|
Loading…
Reference in New Issue
Block a user