removed eclipse warnings, unused fields. Made inner classes static where possible.
This commit is contained in:
parent
70f9280cb6
commit
26016ca66e
@ -24,7 +24,6 @@ import java.math.BigInteger;
|
|||||||
*
|
*
|
||||||
* @author Inderjeet Singh
|
* @author Inderjeet Singh
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public final class LazilyParsedNumber extends Number {
|
public final class LazilyParsedNumber extends Number {
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ import java.util.Set;
|
|||||||
* LinkedHashMap classes.
|
* LinkedHashMap classes.
|
||||||
*/
|
*/
|
||||||
public final class LinkedHashTreeMap<K, V> extends AbstractMap<K, V> implements Serializable {
|
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>() {
|
private static final Comparator<Comparable> NATURAL_ORDER = new Comparator<Comparable>() {
|
||||||
public int compare(Comparable a, Comparable b) {
|
public int compare(Comparable a, Comparable b) {
|
||||||
return a.compareTo(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
|
* @param comparator the comparator to order elements with, or {@code null} to
|
||||||
* use the natural ordering.
|
* 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) {
|
public LinkedHashTreeMap(Comparator<? super K> comparator) {
|
||||||
this.comparator = comparator != null
|
this.comparator = comparator != null
|
||||||
? comparator
|
? comparator
|
||||||
@ -504,6 +504,7 @@ public final class LinkedHashTreeMap<K, V> extends AbstractMap<K, V> implements
|
|||||||
return oldValue;
|
return oldValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
@Override public boolean equals(Object o) {
|
@Override public boolean equals(Object o) {
|
||||||
if (o instanceof Entry) {
|
if (o instanceof Entry) {
|
||||||
Entry other = (Entry) o;
|
Entry other = (Entry) o;
|
||||||
|
@ -51,12 +51,10 @@ public final class ArrayTypeAdapter<E> extends TypeAdapter<Object> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Gson context;
|
|
||||||
private final Class<E> componentType;
|
private final Class<E> componentType;
|
||||||
private final TypeAdapter<E> componentTypeAdapter;
|
private final TypeAdapter<E> componentTypeAdapter;
|
||||||
|
|
||||||
public ArrayTypeAdapter(Gson context, TypeAdapter<E> componentTypeAdapter, Class<E> componentType) {
|
public ArrayTypeAdapter(Gson context, TypeAdapter<E> componentTypeAdapter, Class<E> componentType) {
|
||||||
this.context = context;
|
|
||||||
this.componentTypeAdapter =
|
this.componentTypeAdapter =
|
||||||
new TypeAdapterRuntimeTypeWrapper<E>(context, componentTypeAdapter, componentType);
|
new TypeAdapterRuntimeTypeWrapper<E>(context, componentTypeAdapter, componentType);
|
||||||
this.componentType = componentType;
|
this.componentType = componentType;
|
||||||
|
@ -57,17 +57,13 @@ public final class CollectionTypeAdapterFactory implements TypeAdapterFactory {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class Adapter<E> extends TypeAdapter<Collection<E>> {
|
private static final class Adapter<E> extends TypeAdapter<Collection<E>> {
|
||||||
private final Gson context;
|
|
||||||
private final Type elementType;
|
|
||||||
private final TypeAdapter<E> elementTypeAdapter;
|
private final TypeAdapter<E> elementTypeAdapter;
|
||||||
private final ObjectConstructor<? extends Collection<E>> constructor;
|
private final ObjectConstructor<? extends Collection<E>> constructor;
|
||||||
|
|
||||||
public Adapter(Gson context, Type elementType,
|
public Adapter(Gson context, Type elementType,
|
||||||
TypeAdapter<E> elementTypeAdapter,
|
TypeAdapter<E> elementTypeAdapter,
|
||||||
ObjectConstructor<? extends Collection<E>> constructor) {
|
ObjectConstructor<? extends Collection<E>> constructor) {
|
||||||
this.context = context;
|
|
||||||
this.elementType = elementType;
|
|
||||||
this.elementTypeAdapter =
|
this.elementTypeAdapter =
|
||||||
new TypeAdapterRuntimeTypeWrapper<E>(context, elementTypeAdapter, elementType);
|
new TypeAdapterRuntimeTypeWrapper<E>(context, elementTypeAdapter, elementType);
|
||||||
this.constructor = constructor;
|
this.constructor = constructor;
|
||||||
|
@ -143,9 +143,6 @@ public final class MapTypeAdapterFactory implements TypeAdapterFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final class Adapter<K, V> extends TypeAdapter<Map<K, V>> {
|
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<K> keyTypeAdapter;
|
||||||
private final TypeAdapter<V> valueTypeAdapter;
|
private final TypeAdapter<V> valueTypeAdapter;
|
||||||
private final ObjectConstructor<? extends Map<K, V>> constructor;
|
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,
|
public Adapter(Gson context, Type keyType, TypeAdapter<K> keyTypeAdapter,
|
||||||
Type valueType, TypeAdapter<V> valueTypeAdapter,
|
Type valueType, TypeAdapter<V> valueTypeAdapter,
|
||||||
ObjectConstructor<? extends Map<K, V>> constructor) {
|
ObjectConstructor<? extends Map<K, V>> constructor) {
|
||||||
this.context = context;
|
|
||||||
this.keyType = keyType;
|
|
||||||
this.valueType = valueType;
|
|
||||||
this.keyTypeAdapter =
|
this.keyTypeAdapter =
|
||||||
new TypeAdapterRuntimeTypeWrapper<K>(context, keyTypeAdapter, keyType);
|
new TypeAdapterRuntimeTypeWrapper<K>(context, keyTypeAdapter, keyType);
|
||||||
this.valueTypeAdapter =
|
this.valueTypeAdapter =
|
||||||
|
@ -32,6 +32,7 @@ public final class JsonNullTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testDeepCopy() {
|
public void testDeepCopy() {
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
JsonNull a = new JsonNull();
|
JsonNull a = new JsonNull();
|
||||||
assertSame(JsonNull.INSTANCE, a.deepCopy());
|
assertSame(JsonNull.INSTANCE, a.deepCopy());
|
||||||
assertSame(JsonNull.INSTANCE, JsonNull.INSTANCE.deepCopy());
|
assertSame(JsonNull.INSTANCE, JsonNull.INSTANCE.deepCopy());
|
||||||
|
Loading…
Reference in New Issue
Block a user