EnumTypeAdapterFactor: Remove unnecessary cast
Also suppress a warning about usage of raw types. Change-Id: I0826549a7ae68880cfe98d072e0bb4729c8d093e
This commit is contained in:
committed by
David Pursehouse
parent
d319796e91
commit
1d8a4761a2
@@ -34,7 +34,7 @@ import java.io.IOException;
|
|||||||
public class EnumTypeAdapterFactory implements TypeAdapterFactory {
|
public class EnumTypeAdapterFactory implements TypeAdapterFactory {
|
||||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||||
|
|
||||||
@SuppressWarnings({"unchecked"})
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@Override
|
@Override
|
||||||
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
|
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
|
||||||
TypeAdapter<T> defaultEnumAdapter = TypeAdapters.ENUM_FACTORY.create(gson, typeToken);
|
TypeAdapter<T> defaultEnumAdapter = TypeAdapters.ENUM_FACTORY.create(gson, typeToken);
|
||||||
@@ -43,7 +43,7 @@ public class EnumTypeAdapterFactory implements TypeAdapterFactory {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (TypeAdapter<T>) new EnumTypeAdapter(defaultEnumAdapter, typeToken);
|
return new EnumTypeAdapter(defaultEnumAdapter, typeToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> {
|
private static class EnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> {
|
||||||
|
|||||||
Reference in New Issue
Block a user