From 26016ca66e8cb76ada0a01fa9420a88a8d346f68 Mon Sep 17 00:00:00 2001 From: Inderjeet Singh Date: Fri, 12 Apr 2013 20:09:08 +0000 Subject: [PATCH] removed eclipse warnings, unused fields. Made inner classes static where possible. --- .../java/com/google/gson/internal/LazilyParsedNumber.java | 1 - .../java/com/google/gson/internal/LinkedHashTreeMap.java | 5 +++-- .../com/google/gson/internal/bind/ArrayTypeAdapter.java | 2 -- .../gson/internal/bind/CollectionTypeAdapterFactory.java | 6 +----- .../google/gson/internal/bind/MapTypeAdapterFactory.java | 6 ------ gson/src/test/java/com/google/gson/JsonNullTest.java | 1 + 6 files changed, 5 insertions(+), 16 deletions(-) diff --git a/gson/src/main/java/com/google/gson/internal/LazilyParsedNumber.java b/gson/src/main/java/com/google/gson/internal/LazilyParsedNumber.java index 897ec066..42bbaa1b 100644 --- a/gson/src/main/java/com/google/gson/internal/LazilyParsedNumber.java +++ b/gson/src/main/java/com/google/gson/internal/LazilyParsedNumber.java @@ -24,7 +24,6 @@ import java.math.BigInteger; * * @author Inderjeet Singh */ -@SuppressWarnings("serial") public final class LazilyParsedNumber extends Number { private final String value; diff --git a/gson/src/main/java/com/google/gson/internal/LinkedHashTreeMap.java b/gson/src/main/java/com/google/gson/internal/LinkedHashTreeMap.java index be21aee5..7597ef34 100644 --- a/gson/src/main/java/com/google/gson/internal/LinkedHashTreeMap.java +++ b/gson/src/main/java/com/google/gson/internal/LinkedHashTreeMap.java @@ -38,7 +38,7 @@ import java.util.Set; * LinkedHashMap classes. */ public final class LinkedHashTreeMap extends AbstractMap implements Serializable { - @SuppressWarnings("unchecked") // to avoid Comparable>> + @SuppressWarnings({ "unchecked", "rawtypes" }) // to avoid Comparable>> private static final Comparator NATURAL_ORDER = new Comparator() { public int compare(Comparable a, Comparable b) { return a.compareTo(b); @@ -68,7 +68,7 @@ public final class LinkedHashTreeMap extends AbstractMap implements * @param comparator the comparator to order elements with, or {@code null} to * use the natural ordering. */ - @SuppressWarnings("unchecked") // unsafe! if comparator is null, this assumes K is comparable + @SuppressWarnings({ "unchecked", "rawtypes" }) // unsafe! if comparator is null, this assumes K is comparable public LinkedHashTreeMap(Comparator comparator) { this.comparator = comparator != null ? comparator @@ -504,6 +504,7 @@ public final class LinkedHashTreeMap extends AbstractMap implements return oldValue; } + @SuppressWarnings("rawtypes") @Override public boolean equals(Object o) { if (o instanceof Entry) { Entry other = (Entry) o; diff --git a/gson/src/main/java/com/google/gson/internal/bind/ArrayTypeAdapter.java b/gson/src/main/java/com/google/gson/internal/bind/ArrayTypeAdapter.java index 8e639df3..55d7e309 100644 --- a/gson/src/main/java/com/google/gson/internal/bind/ArrayTypeAdapter.java +++ b/gson/src/main/java/com/google/gson/internal/bind/ArrayTypeAdapter.java @@ -51,12 +51,10 @@ public final class ArrayTypeAdapter extends TypeAdapter { } }; - private final Gson context; private final Class componentType; private final TypeAdapter componentTypeAdapter; public ArrayTypeAdapter(Gson context, TypeAdapter componentTypeAdapter, Class componentType) { - this.context = context; this.componentTypeAdapter = new TypeAdapterRuntimeTypeWrapper(context, componentTypeAdapter, componentType); this.componentType = componentType; diff --git a/gson/src/main/java/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java b/gson/src/main/java/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java index c1c9705b..0b95445a 100644 --- a/gson/src/main/java/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java +++ b/gson/src/main/java/com/google/gson/internal/bind/CollectionTypeAdapterFactory.java @@ -57,17 +57,13 @@ public final class CollectionTypeAdapterFactory implements TypeAdapterFactory { return result; } - private final class Adapter extends TypeAdapter> { - private final Gson context; - private final Type elementType; + private static final class Adapter extends TypeAdapter> { private final TypeAdapter elementTypeAdapter; private final ObjectConstructor> constructor; public Adapter(Gson context, Type elementType, TypeAdapter elementTypeAdapter, ObjectConstructor> constructor) { - this.context = context; - this.elementType = elementType; this.elementTypeAdapter = new TypeAdapterRuntimeTypeWrapper(context, elementTypeAdapter, elementType); this.constructor = constructor; diff --git a/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java b/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java index 37a9babc..c3c616c4 100644 --- a/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java +++ b/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java @@ -143,9 +143,6 @@ public final class MapTypeAdapterFactory implements TypeAdapterFactory { } private final class Adapter extends TypeAdapter> { - private final Gson context; - private final Type keyType; - private final Type valueType; private final TypeAdapter keyTypeAdapter; private final TypeAdapter valueTypeAdapter; private final ObjectConstructor> constructor; @@ -153,9 +150,6 @@ public final class MapTypeAdapterFactory implements TypeAdapterFactory { public Adapter(Gson context, Type keyType, TypeAdapter keyTypeAdapter, Type valueType, TypeAdapter valueTypeAdapter, ObjectConstructor> constructor) { - this.context = context; - this.keyType = keyType; - this.valueType = valueType; this.keyTypeAdapter = new TypeAdapterRuntimeTypeWrapper(context, keyTypeAdapter, keyType); this.valueTypeAdapter = diff --git a/gson/src/test/java/com/google/gson/JsonNullTest.java b/gson/src/test/java/com/google/gson/JsonNullTest.java index b41c96c1..6157e387 100644 --- a/gson/src/test/java/com/google/gson/JsonNullTest.java +++ b/gson/src/test/java/com/google/gson/JsonNullTest.java @@ -32,6 +32,7 @@ public final class JsonNullTest extends TestCase { } public void testDeepCopy() { + @SuppressWarnings("deprecation") JsonNull a = new JsonNull(); assertSame(JsonNull.INSTANCE, a.deepCopy()); assertSame(JsonNull.INSTANCE, JsonNull.INSTANCE.deepCopy());