removed eclipse warnings, unused fields. Made inner classes static where possible.

This commit is contained in:
Inderjeet Singh 2013-04-12 20:09:08 +00:00
parent 70f9280cb6
commit 26016ca66e
6 changed files with 5 additions and 16 deletions

View File

@ -24,7 +24,6 @@ import java.math.BigInteger;
*
* @author Inderjeet Singh
*/
@SuppressWarnings("serial")
public final class LazilyParsedNumber extends Number {
private final String value;

View File

@ -38,7 +38,7 @@ import java.util.Set;
* LinkedHashMap classes.
*/
public final class LinkedHashTreeMap<K, V> extends AbstractMap<K, V> implements Serializable {
@SuppressWarnings("unchecked") // to avoid Comparable<Comparable<Comparable<...>>>
@SuppressWarnings({ "unchecked", "rawtypes" }) // to avoid Comparable<Comparable<Comparable<...>>>
private static final Comparator<Comparable> NATURAL_ORDER = new Comparator<Comparable>() {
public int compare(Comparable a, Comparable b) {
return a.compareTo(b);
@ -68,7 +68,7 @@ public final class LinkedHashTreeMap<K, V> extends AbstractMap<K, V> 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<? super K> comparator) {
this.comparator = comparator != null
? comparator
@ -504,6 +504,7 @@ public final class LinkedHashTreeMap<K, V> extends AbstractMap<K, V> implements
return oldValue;
}
@SuppressWarnings("rawtypes")
@Override public boolean equals(Object o) {
if (o instanceof Entry) {
Entry other = (Entry) o;

View File

@ -51,12 +51,10 @@ public final class ArrayTypeAdapter<E> extends TypeAdapter<Object> {
}
};
private final Gson context;
private final Class<E> componentType;
private final TypeAdapter<E> componentTypeAdapter;
public ArrayTypeAdapter(Gson context, TypeAdapter<E> componentTypeAdapter, Class<E> componentType) {
this.context = context;
this.componentTypeAdapter =
new TypeAdapterRuntimeTypeWrapper<E>(context, componentTypeAdapter, componentType);
this.componentType = componentType;

View File

@ -57,17 +57,13 @@ public final class CollectionTypeAdapterFactory implements TypeAdapterFactory {
return result;
}
private final class Adapter<E> extends TypeAdapter<Collection<E>> {
private final Gson context;
private final Type elementType;
private static final class Adapter<E> extends TypeAdapter<Collection<E>> {
private final TypeAdapter<E> elementTypeAdapter;
private final ObjectConstructor<? extends Collection<E>> constructor;
public Adapter(Gson context, Type elementType,
TypeAdapter<E> elementTypeAdapter,
ObjectConstructor<? extends Collection<E>> constructor) {
this.context = context;
this.elementType = elementType;
this.elementTypeAdapter =
new TypeAdapterRuntimeTypeWrapper<E>(context, elementTypeAdapter, elementType);
this.constructor = constructor;

View File

@ -143,9 +143,6 @@ public final class MapTypeAdapterFactory implements TypeAdapterFactory {
}
private final class Adapter<K, V> extends TypeAdapter<Map<K, V>> {
private final Gson context;
private final Type keyType;
private final Type valueType;
private final TypeAdapter<K> keyTypeAdapter;
private final TypeAdapter<V> valueTypeAdapter;
private final ObjectConstructor<? extends Map<K, V>> constructor;
@ -153,9 +150,6 @@ public final class MapTypeAdapterFactory implements TypeAdapterFactory {
public Adapter(Gson context, Type keyType, TypeAdapter<K> keyTypeAdapter,
Type valueType, TypeAdapter<V> valueTypeAdapter,
ObjectConstructor<? extends Map<K, V>> constructor) {
this.context = context;
this.keyType = keyType;
this.valueType = valueType;
this.keyTypeAdapter =
new TypeAdapterRuntimeTypeWrapper<K>(context, keyTypeAdapter, keyType);
this.valueTypeAdapter =

View File

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