removed compiler warnings
This commit is contained in:
parent
883ce465d5
commit
8380d28e6f
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.google.gson;
|
package com.google.gson;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.google.gson;
|
package com.google.gson;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.google.gson;
|
package com.google.gson;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import java.lang.reflect.AccessibleObject;
|
import java.lang.reflect.AccessibleObject;
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
@ -16,14 +16,9 @@
|
|||||||
|
|
||||||
package com.google.gson;
|
package com.google.gson;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import java.lang.reflect.AccessibleObject;
|
import java.lang.reflect.AccessibleObject;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.ParameterizedType;
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides ability to apply a visitor to an object and all of its fields
|
* Provides ability to apply a visitor to an object and all of its fields
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.google.gson;
|
package com.google.gson;
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -195,8 +195,8 @@ public final class Types {
|
|||||||
if (!(b instanceof TypeVariable)) {
|
if (!(b instanceof TypeVariable)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TypeVariable<?> va = (TypeVariable) a;
|
TypeVariable<?> va = (TypeVariable<?>) a;
|
||||||
TypeVariable<?> vb = (TypeVariable) b;
|
TypeVariable<?> vb = (TypeVariable<?>) b;
|
||||||
return va.getGenericDeclaration() == vb.getGenericDeclaration()
|
return va.getGenericDeclaration() == vb.getGenericDeclaration()
|
||||||
&& va.getName().equals(vb.getName());
|
&& va.getName().equals(vb.getName());
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ public final class Types {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String typeToString(Type type) {
|
public static String typeToString(Type type) {
|
||||||
return type instanceof Class ? ((Class) type).getName() : type.toString();
|
return type instanceof Class ? ((Class<?>) type).getName() : type.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,7 +226,7 @@ public final class Types {
|
|||||||
|
|
||||||
// we skip searching through interfaces if unknown is an interface
|
// we skip searching through interfaces if unknown is an interface
|
||||||
if (toResolve.isInterface()) {
|
if (toResolve.isInterface()) {
|
||||||
Class[] interfaces = rawType.getInterfaces();
|
Class<?>[] interfaces = rawType.getInterfaces();
|
||||||
for (int i = 0, length = interfaces.length; i < length; i++) {
|
for (int i = 0, length = interfaces.length; i < length; i++) {
|
||||||
if (interfaces[i] == toResolve) {
|
if (interfaces[i] == toResolve) {
|
||||||
return rawType.getGenericInterfaces()[i];
|
return rawType.getGenericInterfaces()[i];
|
||||||
@ -316,7 +316,7 @@ public final class Types {
|
|||||||
// this implementation is made a little more complicated in an attempt to avoid object-creation
|
// this implementation is made a little more complicated in an attempt to avoid object-creation
|
||||||
while (true) {
|
while (true) {
|
||||||
if (toResolve instanceof TypeVariable) {
|
if (toResolve instanceof TypeVariable) {
|
||||||
TypeVariable typeVariable = (TypeVariable) toResolve;
|
TypeVariable<?> typeVariable = (TypeVariable<?>) toResolve;
|
||||||
toResolve = resolveTypeVariable(context, contextRawType, typeVariable);
|
toResolve = resolveTypeVariable(context, contextRawType, typeVariable);
|
||||||
if (toResolve == typeVariable) {
|
if (toResolve == typeVariable) {
|
||||||
return toResolve;
|
return toResolve;
|
||||||
@ -384,6 +384,7 @@ public final class Types {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
static Type resolveTypeVariable(Type context, Class<?> contextRawType, TypeVariable unknown) {
|
static Type resolveTypeVariable(Type context, Class<?> contextRawType, TypeVariable unknown) {
|
||||||
Class<?> declaredByRaw = declaringClassOf(unknown);
|
Class<?> declaredByRaw = declaringClassOf(unknown);
|
||||||
|
|
||||||
@ -414,6 +415,7 @@ public final class Types {
|
|||||||
* Returns the declaring class of {@code typeVariable}, or {@code null} if it was not declared by
|
* Returns the declaring class of {@code typeVariable}, or {@code null} if it was not declared by
|
||||||
* a class.
|
* a class.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
private static Class<?> declaringClassOf(TypeVariable typeVariable) {
|
private static Class<?> declaringClassOf(TypeVariable typeVariable) {
|
||||||
GenericDeclaration genericDeclaration = typeVariable.getGenericDeclaration();
|
GenericDeclaration genericDeclaration = typeVariable.getGenericDeclaration();
|
||||||
return genericDeclaration instanceof Class
|
return genericDeclaration instanceof Class
|
||||||
@ -422,7 +424,7 @@ public final class Types {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void checkNotPrimitive(Type type) {
|
private static void checkNotPrimitive(Type type) {
|
||||||
checkArgument(!(type instanceof Class<?>) || !((Class) type).isPrimitive());
|
checkArgument(!(type instanceof Class<?>) || !((Class<?>) type).isPrimitive());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ParameterizedTypeImpl implements ParameterizedType, Serializable {
|
private static class ParameterizedTypeImpl implements ParameterizedType, Serializable {
|
||||||
@ -430,6 +432,7 @@ public final class Types {
|
|||||||
private final Type rawType;
|
private final Type rawType;
|
||||||
private final Type[] typeArguments;
|
private final Type[] typeArguments;
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
|
public ParameterizedTypeImpl(Type ownerType, Type rawType, Type... typeArguments) {
|
||||||
// require an owner type if the raw type needs it
|
// require an owner type if the raw type needs it
|
||||||
if (rawType instanceof Class<?>) {
|
if (rawType instanceof Class<?>) {
|
||||||
|
@ -299,7 +299,7 @@ public class TypeToken<T> {
|
|||||||
|
|
||||||
@Override public final boolean equals(Object o) {
|
@Override public final boolean equals(Object o) {
|
||||||
return o instanceof TypeToken<?>
|
return o instanceof TypeToken<?>
|
||||||
&& Types.equals(type, ((TypeToken) o).type);
|
&& Types.equals(type, ((TypeToken<?>) o).type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public final String toString() {
|
@Override public final String toString() {
|
||||||
|
@ -757,7 +757,7 @@ public final class JsonReaderTest extends TestCase {
|
|||||||
assertEquals(JsonToken.END_DOCUMENT, reader.peek());
|
assertEquals(JsonToken.END_DOCUMENT, reader.peek());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLenientPartialNonExecutePrefix() throws IOException {
|
public void testLenientPartialNonExecutePrefix() {
|
||||||
JsonReader reader = new JsonReader(new StringReader(")]}' []"));
|
JsonReader reader = new JsonReader(new StringReader(")]}' []"));
|
||||||
reader.setLenient(true);
|
reader.setLenient(true);
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user