replaced unchecked suppressed warnings token with more specific rawtypes.

removed unused imports.
This commit is contained in:
Inderjeet Singh 2010-08-20 16:27:46 +00:00
parent ed838ec104
commit de0f8da151
10 changed files with 10 additions and 14 deletions

View File

@ -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> {

View File

@ -31,6 +31,7 @@ final class FieldNamingStrategy2Adapter implements FieldNamingStrategy2 {
this.adaptee = adaptee;
}
@SuppressWarnings("deprecation")
public String translateName(FieldAttributes f) {
return adaptee.translateName(f.getFieldObject());
}

View File

@ -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) {

View File

@ -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)) {

View File

@ -32,7 +32,7 @@ import java.util.Map;
*/
public class DefaultMapJsonSerializerTest extends TestCase {
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
private JsonSerializer<Map> mapSerializer;
@Override

View File

@ -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.
*

View File

@ -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) {

View File

@ -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);

View File

@ -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,

View File

@ -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]}";