Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package com.google.gson.internal;
/* renamed from: com.google.gson.internal.$Gson$Preconditions, reason: invalid class name */
/* loaded from: classes3.dex */
public final class C$Gson$Preconditions {
private C$Gson$Preconditions() {
throw new UnsupportedOperationException();
}
public static <T> T checkNotNull(T t) {
t.getClass();
return t;
}
public static void checkArgument(boolean z) {
if (!z) {
throw new IllegalArgumentException();
}
}
}

View File

@@ -0,0 +1,538 @@
package com.google.gson.internal;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Properties;
/* renamed from: com.google.gson.internal.$Gson$Types, reason: invalid class name */
/* loaded from: classes3.dex */
public final class C$Gson$Types {
static final Type[] EMPTY_TYPE_ARRAY = new Type[0];
private C$Gson$Types() {
throw new UnsupportedOperationException();
}
public static ParameterizedType newParameterizedTypeWithOwner(Type type, Type type2, Type... typeArr) {
return new ParameterizedTypeImpl(type, type2, typeArr);
}
public static GenericArrayType arrayOf(Type type) {
return new GenericArrayTypeImpl(type);
}
public static WildcardType subtypeOf(Type type) {
return new WildcardTypeImpl(type instanceof WildcardType ? ((WildcardType) type).getUpperBounds() : new Type[]{type}, EMPTY_TYPE_ARRAY);
}
public static WildcardType supertypeOf(Type type) {
return new WildcardTypeImpl(new Type[]{Object.class}, type instanceof WildcardType ? ((WildcardType) type).getLowerBounds() : new Type[]{type});
}
public static Type canonicalize(Type type) {
if (type instanceof Class) {
Class cls = (Class) type;
return cls.isArray() ? new GenericArrayTypeImpl(canonicalize(cls.getComponentType())) : cls;
}
if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) type;
return new ParameterizedTypeImpl(parameterizedType.getOwnerType(), parameterizedType.getRawType(), parameterizedType.getActualTypeArguments());
}
if (type instanceof GenericArrayType) {
return new GenericArrayTypeImpl(((GenericArrayType) type).getGenericComponentType());
}
if (!(type instanceof WildcardType)) {
return type;
}
WildcardType wildcardType = (WildcardType) type;
return new WildcardTypeImpl(wildcardType.getUpperBounds(), wildcardType.getLowerBounds());
}
public static Class<?> getRawType(Type type) {
if (type instanceof Class) {
return (Class) type;
}
if (type instanceof ParameterizedType) {
Type rawType = ((ParameterizedType) type).getRawType();
C$Gson$Preconditions.checkArgument(rawType instanceof Class);
return (Class) rawType;
}
if (type instanceof GenericArrayType) {
return Array.newInstance(getRawType(((GenericArrayType) type).getGenericComponentType()), 0).getClass();
}
if (type instanceof TypeVariable) {
return Object.class;
}
if (type instanceof WildcardType) {
return getRawType(((WildcardType) type).getUpperBounds()[0]);
}
throw new IllegalArgumentException("Expected a Class, ParameterizedType, or GenericArrayType, but <" + type + "> is of type " + (type == null ? "null" : type.getClass().getName()));
}
public static boolean equal(Object obj, Object obj2) {
return obj == obj2 || (obj != null && obj.equals(obj2));
}
public static boolean equals(Type type, Type type2) {
if (type == type2) {
return true;
}
if (type instanceof Class) {
return type.equals(type2);
}
if (type instanceof ParameterizedType) {
if (!(type2 instanceof ParameterizedType)) {
return false;
}
ParameterizedType parameterizedType = (ParameterizedType) type;
ParameterizedType parameterizedType2 = (ParameterizedType) type2;
return equal(parameterizedType.getOwnerType(), parameterizedType2.getOwnerType()) && parameterizedType.getRawType().equals(parameterizedType2.getRawType()) && Arrays.equals(parameterizedType.getActualTypeArguments(), parameterizedType2.getActualTypeArguments());
}
if (type instanceof GenericArrayType) {
if (type2 instanceof GenericArrayType) {
return equals(((GenericArrayType) type).getGenericComponentType(), ((GenericArrayType) type2).getGenericComponentType());
}
return false;
}
if (type instanceof WildcardType) {
if (!(type2 instanceof WildcardType)) {
return false;
}
WildcardType wildcardType = (WildcardType) type;
WildcardType wildcardType2 = (WildcardType) type2;
return Arrays.equals(wildcardType.getUpperBounds(), wildcardType2.getUpperBounds()) && Arrays.equals(wildcardType.getLowerBounds(), wildcardType2.getLowerBounds());
}
if (!(type instanceof TypeVariable) || !(type2 instanceof TypeVariable)) {
return false;
}
TypeVariable typeVariable = (TypeVariable) type;
TypeVariable typeVariable2 = (TypeVariable) type2;
return typeVariable.getGenericDeclaration() == typeVariable2.getGenericDeclaration() && typeVariable.getName().equals(typeVariable2.getName());
}
public static int hashCodeOrZero(Object obj) {
if (obj != null) {
return obj.hashCode();
}
return 0;
}
public static String typeToString(Type type) {
return type instanceof Class ? ((Class) type).getName() : type.toString();
}
public static Type getGenericSupertype(Type type, Class<?> cls, Class<?> cls2) {
if (cls2 == cls) {
return type;
}
if (cls2.isInterface()) {
Class<?>[] interfaces = cls.getInterfaces();
int length = interfaces.length;
for (int i = 0; i < length; i++) {
Class<?> cls3 = interfaces[i];
if (cls3 == cls2) {
return cls.getGenericInterfaces()[i];
}
if (cls2.isAssignableFrom(cls3)) {
return getGenericSupertype(cls.getGenericInterfaces()[i], interfaces[i], cls2);
}
}
}
if (!cls.isInterface()) {
while (cls != Object.class) {
Class<? super Object> superclass = cls.getSuperclass();
if (superclass == cls2) {
return cls.getGenericSuperclass();
}
if (cls2.isAssignableFrom(superclass)) {
return getGenericSupertype(cls.getGenericSuperclass(), superclass, cls2);
}
cls = superclass;
}
}
return cls2;
}
public static Type getSupertype(Type type, Class<?> cls, Class<?> cls2) {
if (type instanceof WildcardType) {
type = ((WildcardType) type).getUpperBounds()[0];
}
C$Gson$Preconditions.checkArgument(cls2.isAssignableFrom(cls));
return resolve(type, cls, getGenericSupertype(type, cls, cls2));
}
public static Type getArrayComponentType(Type type) {
if (type instanceof GenericArrayType) {
return ((GenericArrayType) type).getGenericComponentType();
}
return ((Class) type).getComponentType();
}
public static Type getCollectionElementType(Type type, Class<?> cls) {
Type supertype = getSupertype(type, cls, Collection.class);
if (supertype instanceof WildcardType) {
supertype = ((WildcardType) supertype).getUpperBounds()[0];
}
return supertype instanceof ParameterizedType ? ((ParameterizedType) supertype).getActualTypeArguments()[0] : Object.class;
}
public static Type[] getMapKeyAndValueTypes(Type type, Class<?> cls) {
if (type == Properties.class) {
return new Type[]{String.class, String.class};
}
Type supertype = getSupertype(type, cls, Map.class);
return supertype instanceof ParameterizedType ? ((ParameterizedType) supertype).getActualTypeArguments() : new Type[]{Object.class, Object.class};
}
public static Type resolve(Type type, Class<?> cls, Type type2) {
return resolve(type, cls, type2, new HashMap());
}
/* JADX WARN: Code restructure failed: missing block: B:12:0x00dc, code lost:
if (r0 == null) goto L59;
*/
/* JADX WARN: Code restructure failed: missing block: B:13:0x00de, code lost:
r12.put(r0, r11);
*/
/* JADX WARN: Code restructure failed: missing block: B:14:0x00e1, code lost:
return r11;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r11v0, types: [java.lang.reflect.Type] */
/* JADX WARN: Type inference failed for: r11v1, types: [java.lang.reflect.Type] */
/* JADX WARN: Type inference failed for: r11v10, types: [java.lang.Object, java.lang.reflect.Type] */
/* JADX WARN: Type inference failed for: r11v13, types: [java.lang.reflect.Type] */
/* JADX WARN: Type inference failed for: r11v2, types: [java.lang.reflect.WildcardType] */
/* JADX WARN: Type inference failed for: r11v3, types: [java.lang.reflect.WildcardType] */
/* JADX WARN: Type inference failed for: r11v4, types: [java.lang.reflect.WildcardType] */
/* JADX WARN: Type inference failed for: r11v5, types: [java.lang.reflect.ParameterizedType] */
/* JADX WARN: Type inference failed for: r11v6, types: [java.lang.reflect.GenericArrayType] */
/* JADX WARN: Type inference failed for: r11v7 */
/* JADX WARN: Type inference failed for: r11v9 */
/* JADX WARN: Type inference failed for: r12v0, types: [java.util.Map, java.util.Map<java.lang.reflect.TypeVariable<?>, java.lang.reflect.Type>] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static java.lang.reflect.Type resolve(java.lang.reflect.Type r9, java.lang.Class<?> r10, java.lang.reflect.Type r11, java.util.Map<java.lang.reflect.TypeVariable<?>, java.lang.reflect.Type> r12) {
/*
r0 = 0
L1:
boolean r1 = r11 instanceof java.lang.reflect.TypeVariable
if (r1 == 0) goto L27
r1 = r11
java.lang.reflect.TypeVariable r1 = (java.lang.reflect.TypeVariable) r1
java.lang.Object r2 = r12.get(r1)
java.lang.reflect.Type r2 = (java.lang.reflect.Type) r2
if (r2 == 0) goto L17
java.lang.Class r9 = java.lang.Void.TYPE
if (r2 != r9) goto L15
goto L16
L15:
r11 = r2
L16:
return r11
L17:
java.lang.Class r11 = java.lang.Void.TYPE
r12.put(r1, r11)
if (r0 != 0) goto L1f
r0 = r1
L1f:
java.lang.reflect.Type r11 = resolveTypeVariable(r9, r10, r1)
if (r11 != r1) goto L1
goto Ldc
L27:
boolean r1 = r11 instanceof java.lang.Class
if (r1 == 0) goto L4c
r1 = r11
java.lang.Class r1 = (java.lang.Class) r1
boolean r2 = r1.isArray()
if (r2 == 0) goto L4c
java.lang.Class r11 = r1.getComponentType()
java.lang.reflect.Type r9 = resolve(r9, r10, r11, r12)
boolean r10 = equal(r11, r9)
if (r10 == 0) goto L45
r11 = r1
goto Ldc
L45:
java.lang.reflect.GenericArrayType r9 = arrayOf(r9)
L49:
r11 = r9
goto Ldc
L4c:
boolean r1 = r11 instanceof java.lang.reflect.GenericArrayType
if (r1 == 0) goto L67
java.lang.reflect.GenericArrayType r11 = (java.lang.reflect.GenericArrayType) r11
java.lang.reflect.Type r1 = r11.getGenericComponentType()
java.lang.reflect.Type r9 = resolve(r9, r10, r1, r12)
boolean r10 = equal(r1, r9)
if (r10 == 0) goto L62
goto Ldc
L62:
java.lang.reflect.GenericArrayType r9 = arrayOf(r9)
goto L49
L67:
boolean r1 = r11 instanceof java.lang.reflect.ParameterizedType
r2 = 0
r3 = 1
if (r1 == 0) goto Lab
java.lang.reflect.ParameterizedType r11 = (java.lang.reflect.ParameterizedType) r11
java.lang.reflect.Type r1 = r11.getOwnerType()
java.lang.reflect.Type r4 = resolve(r9, r10, r1, r12)
boolean r1 = equal(r4, r1)
r1 = r1 ^ r3
java.lang.reflect.Type[] r5 = r11.getActualTypeArguments()
int r6 = r5.length
L81:
if (r2 >= r6) goto La0
r7 = r5[r2]
java.lang.reflect.Type r7 = resolve(r9, r10, r7, r12)
r8 = r5[r2]
boolean r8 = equal(r7, r8)
if (r8 != 0) goto L9d
if (r1 != 0) goto L9b
java.lang.Object r1 = r5.clone()
r5 = r1
java.lang.reflect.Type[] r5 = (java.lang.reflect.Type[]) r5
r1 = r3
L9b:
r5[r2] = r7
L9d:
int r2 = r2 + 1
goto L81
La0:
if (r1 == 0) goto Ldc
java.lang.reflect.Type r9 = r11.getRawType()
java.lang.reflect.ParameterizedType r9 = newParameterizedTypeWithOwner(r4, r9, r5)
goto L49
Lab:
boolean r1 = r11 instanceof java.lang.reflect.WildcardType
if (r1 == 0) goto Ldc
java.lang.reflect.WildcardType r11 = (java.lang.reflect.WildcardType) r11
java.lang.reflect.Type[] r1 = r11.getLowerBounds()
java.lang.reflect.Type[] r4 = r11.getUpperBounds()
int r5 = r1.length
if (r5 != r3) goto Lcb
r3 = r1[r2]
java.lang.reflect.Type r9 = resolve(r9, r10, r3, r12)
r10 = r1[r2]
if (r9 == r10) goto Ldc
java.lang.reflect.WildcardType r11 = supertypeOf(r9)
goto Ldc
Lcb:
int r1 = r4.length
if (r1 != r3) goto Ldc
r1 = r4[r2]
java.lang.reflect.Type r9 = resolve(r9, r10, r1, r12)
r10 = r4[r2]
if (r9 == r10) goto Ldc
java.lang.reflect.WildcardType r11 = subtypeOf(r9)
Ldc:
if (r0 == 0) goto Le1
r12.put(r0, r11)
Le1:
return r11
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.gson.internal.C$Gson$Types.resolve(java.lang.reflect.Type, java.lang.Class, java.lang.reflect.Type, java.util.Map):java.lang.reflect.Type");
}
public static Type resolveTypeVariable(Type type, Class<?> cls, TypeVariable<?> typeVariable) {
Class<?> declaringClassOf = declaringClassOf(typeVariable);
if (declaringClassOf == null) {
return typeVariable;
}
Type genericSupertype = getGenericSupertype(type, cls, declaringClassOf);
if (!(genericSupertype instanceof ParameterizedType)) {
return typeVariable;
}
return ((ParameterizedType) genericSupertype).getActualTypeArguments()[indexOf(declaringClassOf.getTypeParameters(), typeVariable)];
}
private static int indexOf(Object[] objArr, Object obj) {
int length = objArr.length;
for (int i = 0; i < length; i++) {
if (obj.equals(objArr[i])) {
return i;
}
}
throw new NoSuchElementException();
}
private static Class<?> declaringClassOf(TypeVariable<?> typeVariable) {
Object genericDeclaration = typeVariable.getGenericDeclaration();
if (genericDeclaration instanceof Class) {
return (Class) genericDeclaration;
}
return null;
}
public static void checkNotPrimitive(Type type) {
C$Gson$Preconditions.checkArgument(((type instanceof Class) && ((Class) type).isPrimitive()) ? false : true);
}
/* renamed from: com.google.gson.internal.$Gson$Types$ParameterizedTypeImpl */
public static final class ParameterizedTypeImpl implements ParameterizedType, Serializable {
private static final long serialVersionUID = 0;
private final Type ownerType;
private final Type rawType;
private final Type[] typeArguments;
@Override // java.lang.reflect.ParameterizedType
public Type getOwnerType() {
return this.ownerType;
}
@Override // java.lang.reflect.ParameterizedType
public Type getRawType() {
return this.rawType;
}
public ParameterizedTypeImpl(Type type, Type type2, Type... typeArr) {
if (type2 instanceof Class) {
Class cls = (Class) type2;
boolean z = true;
boolean z2 = Modifier.isStatic(cls.getModifiers()) || cls.getEnclosingClass() == null;
if (type == null && !z2) {
z = false;
}
C$Gson$Preconditions.checkArgument(z);
}
this.ownerType = type == null ? null : C$Gson$Types.canonicalize(type);
this.rawType = C$Gson$Types.canonicalize(type2);
Type[] typeArr2 = (Type[]) typeArr.clone();
this.typeArguments = typeArr2;
int length = typeArr2.length;
for (int i = 0; i < length; i++) {
C$Gson$Preconditions.checkNotNull(this.typeArguments[i]);
C$Gson$Types.checkNotPrimitive(this.typeArguments[i]);
Type[] typeArr3 = this.typeArguments;
typeArr3[i] = C$Gson$Types.canonicalize(typeArr3[i]);
}
}
@Override // java.lang.reflect.ParameterizedType
public Type[] getActualTypeArguments() {
return (Type[]) this.typeArguments.clone();
}
public boolean equals(Object obj) {
return (obj instanceof ParameterizedType) && C$Gson$Types.equals(this, (ParameterizedType) obj);
}
public int hashCode() {
return (Arrays.hashCode(this.typeArguments) ^ this.rawType.hashCode()) ^ C$Gson$Types.hashCodeOrZero(this.ownerType);
}
public String toString() {
int length = this.typeArguments.length;
if (length == 0) {
return C$Gson$Types.typeToString(this.rawType);
}
StringBuilder sb = new StringBuilder((length + 1) * 30);
sb.append(C$Gson$Types.typeToString(this.rawType));
sb.append("<");
sb.append(C$Gson$Types.typeToString(this.typeArguments[0]));
for (int i = 1; i < length; i++) {
sb.append(", ");
sb.append(C$Gson$Types.typeToString(this.typeArguments[i]));
}
sb.append(">");
return sb.toString();
}
}
/* renamed from: com.google.gson.internal.$Gson$Types$GenericArrayTypeImpl */
public static final class GenericArrayTypeImpl implements GenericArrayType, Serializable {
private static final long serialVersionUID = 0;
private final Type componentType;
@Override // java.lang.reflect.GenericArrayType
public Type getGenericComponentType() {
return this.componentType;
}
public GenericArrayTypeImpl(Type type) {
this.componentType = C$Gson$Types.canonicalize(type);
}
public boolean equals(Object obj) {
return (obj instanceof GenericArrayType) && C$Gson$Types.equals(this, (GenericArrayType) obj);
}
public int hashCode() {
return this.componentType.hashCode();
}
public String toString() {
return C$Gson$Types.typeToString(this.componentType) + "[]";
}
}
/* renamed from: com.google.gson.internal.$Gson$Types$WildcardTypeImpl */
public static final class WildcardTypeImpl implements WildcardType, Serializable {
private static final long serialVersionUID = 0;
private final Type lowerBound;
private final Type upperBound;
@Override // java.lang.reflect.WildcardType
public Type[] getUpperBounds() {
return new Type[]{this.upperBound};
}
public WildcardTypeImpl(Type[] typeArr, Type[] typeArr2) {
C$Gson$Preconditions.checkArgument(typeArr2.length <= 1);
C$Gson$Preconditions.checkArgument(typeArr.length == 1);
if (typeArr2.length == 1) {
C$Gson$Preconditions.checkNotNull(typeArr2[0]);
C$Gson$Types.checkNotPrimitive(typeArr2[0]);
C$Gson$Preconditions.checkArgument(typeArr[0] == Object.class);
this.lowerBound = C$Gson$Types.canonicalize(typeArr2[0]);
this.upperBound = Object.class;
return;
}
C$Gson$Preconditions.checkNotNull(typeArr[0]);
C$Gson$Types.checkNotPrimitive(typeArr[0]);
this.lowerBound = null;
this.upperBound = C$Gson$Types.canonicalize(typeArr[0]);
}
@Override // java.lang.reflect.WildcardType
public Type[] getLowerBounds() {
Type type = this.lowerBound;
return type != null ? new Type[]{type} : C$Gson$Types.EMPTY_TYPE_ARRAY;
}
public boolean equals(Object obj) {
return (obj instanceof WildcardType) && C$Gson$Types.equals(this, (WildcardType) obj);
}
public int hashCode() {
Type type = this.lowerBound;
return (type != null ? type.hashCode() + 31 : 1) ^ (this.upperBound.hashCode() + 31);
}
public String toString() {
if (this.lowerBound != null) {
return "? super " + C$Gson$Types.typeToString(this.lowerBound);
}
if (this.upperBound == Object.class) {
return "?";
}
return "? extends " + C$Gson$Types.typeToString(this.upperBound);
}
}
}

View File

@@ -0,0 +1,202 @@
package com.google.gson.internal;
import com.google.gson.InstanceCreator;
import com.google.gson.JsonIOException;
import com.google.gson.internal.reflect.ReflectionAccessor;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
/* loaded from: classes3.dex */
public final class ConstructorConstructor {
private final ReflectionAccessor accessor = ReflectionAccessor.getInstance();
private final Map<Type, InstanceCreator<?>> instanceCreators;
public ConstructorConstructor(Map<Type, InstanceCreator<?>> map) {
this.instanceCreators = map;
}
public <T> ObjectConstructor<T> get(TypeToken<T> typeToken) {
final Type type = typeToken.getType();
Class<? super T> rawType = typeToken.getRawType();
final InstanceCreator<?> instanceCreator = this.instanceCreators.get(type);
if (instanceCreator != null) {
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.1
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
return (T) instanceCreator.createInstance(type);
}
};
}
final InstanceCreator<?> instanceCreator2 = this.instanceCreators.get(rawType);
if (instanceCreator2 != null) {
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.2
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
return (T) instanceCreator2.createInstance(type);
}
};
}
ObjectConstructor<T> newDefaultConstructor = newDefaultConstructor(rawType);
if (newDefaultConstructor != null) {
return newDefaultConstructor;
}
ObjectConstructor<T> newDefaultImplementationConstructor = newDefaultImplementationConstructor(type, rawType);
return newDefaultImplementationConstructor != null ? newDefaultImplementationConstructor : newUnsafeAllocator(type, rawType);
}
private <T> ObjectConstructor<T> newDefaultConstructor(Class<? super T> cls) {
try {
final Constructor<? super T> declaredConstructor = cls.getDeclaredConstructor(new Class[0]);
if (!declaredConstructor.isAccessible()) {
this.accessor.makeAccessible(declaredConstructor);
}
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.3
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
try {
return (T) declaredConstructor.newInstance(null);
} catch (IllegalAccessException e) {
throw new AssertionError(e);
} catch (InstantiationException e2) {
throw new RuntimeException("Failed to invoke " + declaredConstructor + " with no args", e2);
} catch (InvocationTargetException e3) {
throw new RuntimeException("Failed to invoke " + declaredConstructor + " with no args", e3.getTargetException());
}
}
};
} catch (NoSuchMethodException unused) {
return null;
}
}
private <T> ObjectConstructor<T> newDefaultImplementationConstructor(final Type type, Class<? super T> cls) {
if (Collection.class.isAssignableFrom(cls)) {
if (SortedSet.class.isAssignableFrom(cls)) {
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.4
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
return (T) new TreeSet();
}
};
}
if (EnumSet.class.isAssignableFrom(cls)) {
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.5
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
Type type2 = type;
if (type2 instanceof ParameterizedType) {
Type type3 = ((ParameterizedType) type2).getActualTypeArguments()[0];
if (type3 instanceof Class) {
return (T) EnumSet.noneOf((Class) type3);
}
throw new JsonIOException("Invalid EnumSet type: " + type.toString());
}
throw new JsonIOException("Invalid EnumSet type: " + type.toString());
}
};
}
if (Set.class.isAssignableFrom(cls)) {
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.6
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
return (T) new LinkedHashSet();
}
};
}
if (Queue.class.isAssignableFrom(cls)) {
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.7
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
return (T) new ArrayDeque();
}
};
}
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.8
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
return (T) new ArrayList();
}
};
}
if (!Map.class.isAssignableFrom(cls)) {
return null;
}
if (ConcurrentNavigableMap.class.isAssignableFrom(cls)) {
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.9
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
return (T) new ConcurrentSkipListMap();
}
};
}
if (ConcurrentMap.class.isAssignableFrom(cls)) {
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.10
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
return (T) new ConcurrentHashMap();
}
};
}
if (SortedMap.class.isAssignableFrom(cls)) {
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.11
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
return (T) new TreeMap();
}
};
}
if ((type instanceof ParameterizedType) && !String.class.isAssignableFrom(TypeToken.get(((ParameterizedType) type).getActualTypeArguments()[0]).getRawType())) {
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.12
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
return (T) new LinkedHashMap();
}
};
}
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.13
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
return (T) new LinkedTreeMap();
}
};
}
private <T> ObjectConstructor<T> newUnsafeAllocator(final Type type, final Class<? super T> cls) {
return new ObjectConstructor<T>() { // from class: com.google.gson.internal.ConstructorConstructor.14
private final UnsafeAllocator unsafeAllocator = UnsafeAllocator.create();
@Override // com.google.gson.internal.ObjectConstructor
public T construct() {
try {
return (T) this.unsafeAllocator.newInstance(cls);
} catch (Exception e) {
throw new RuntimeException("Unable to invoke no-args constructor for " + type + ". Registering an InstanceCreator with Gson for this type may fix this problem.", e);
}
}
};
}
public String toString() {
return this.instanceCreators.toString();
}
}

View File

@@ -0,0 +1,198 @@
package com.google.gson.internal;
import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.Since;
import com.google.gson.annotations.Until;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes3.dex */
public final class Excluder implements TypeAdapterFactory, Cloneable {
public static final Excluder DEFAULT = new Excluder();
private static final double IGNORE_VERSIONS = -1.0d;
private boolean requireExpose;
private double version = IGNORE_VERSIONS;
private int modifiers = 136;
private boolean serializeInnerClasses = true;
private List<ExclusionStrategy> serializationStrategies = Collections.emptyList();
private List<ExclusionStrategy> deserializationStrategies = Collections.emptyList();
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public Excluder m855clone() {
try {
return (Excluder) super.clone();
} catch (CloneNotSupportedException e) {
throw new AssertionError(e);
}
}
public Excluder withVersion(double d) {
Excluder m855clone = m855clone();
m855clone.version = d;
return m855clone;
}
public Excluder withModifiers(int... iArr) {
Excluder m855clone = m855clone();
m855clone.modifiers = 0;
for (int i : iArr) {
m855clone.modifiers = i | m855clone.modifiers;
}
return m855clone;
}
public Excluder disableInnerClassSerialization() {
Excluder m855clone = m855clone();
m855clone.serializeInnerClasses = false;
return m855clone;
}
public Excluder excludeFieldsWithoutExposeAnnotation() {
Excluder m855clone = m855clone();
m855clone.requireExpose = true;
return m855clone;
}
public Excluder withExclusionStrategy(ExclusionStrategy exclusionStrategy, boolean z, boolean z2) {
Excluder m855clone = m855clone();
if (z) {
ArrayList arrayList = new ArrayList(this.serializationStrategies);
m855clone.serializationStrategies = arrayList;
arrayList.add(exclusionStrategy);
}
if (z2) {
ArrayList arrayList2 = new ArrayList(this.deserializationStrategies);
m855clone.deserializationStrategies = arrayList2;
arrayList2.add(exclusionStrategy);
}
return m855clone;
}
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(final Gson gson, final TypeToken<T> typeToken) {
Class<? super T> rawType = typeToken.getRawType();
boolean excludeClassChecks = excludeClassChecks(rawType);
final boolean z = excludeClassChecks || excludeClassInStrategy(rawType, true);
final boolean z2 = excludeClassChecks || excludeClassInStrategy(rawType, false);
if (z || z2) {
return new TypeAdapter<T>() { // from class: com.google.gson.internal.Excluder.1
private TypeAdapter<T> delegate;
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public T read2(JsonReader jsonReader) throws IOException {
if (z2) {
jsonReader.skipValue();
return null;
}
return delegate().read2(jsonReader);
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, T t) throws IOException {
if (z) {
jsonWriter.nullValue();
} else {
delegate().write(jsonWriter, t);
}
}
private TypeAdapter<T> delegate() {
TypeAdapter<T> typeAdapter = this.delegate;
if (typeAdapter != null) {
return typeAdapter;
}
TypeAdapter<T> delegateAdapter = gson.getDelegateAdapter(Excluder.this, typeToken);
this.delegate = delegateAdapter;
return delegateAdapter;
}
};
}
return null;
}
public boolean excludeField(Field field, boolean z) {
Expose expose;
if ((this.modifiers & field.getModifiers()) != 0) {
return true;
}
if ((this.version != IGNORE_VERSIONS && !isValidVersion((Since) field.getAnnotation(Since.class), (Until) field.getAnnotation(Until.class))) || field.isSynthetic()) {
return true;
}
if (this.requireExpose && ((expose = (Expose) field.getAnnotation(Expose.class)) == null || (!z ? expose.deserialize() : expose.serialize()))) {
return true;
}
if ((!this.serializeInnerClasses && isInnerClass(field.getType())) || isAnonymousOrNonStaticLocal(field.getType())) {
return true;
}
List<ExclusionStrategy> list = z ? this.serializationStrategies : this.deserializationStrategies;
if (list.isEmpty()) {
return false;
}
FieldAttributes fieldAttributes = new FieldAttributes(field);
Iterator<ExclusionStrategy> it = list.iterator();
while (it.hasNext()) {
if (it.next().shouldSkipField(fieldAttributes)) {
return true;
}
}
return false;
}
private boolean excludeClassChecks(Class<?> cls) {
if (this.version == IGNORE_VERSIONS || isValidVersion((Since) cls.getAnnotation(Since.class), (Until) cls.getAnnotation(Until.class))) {
return (!this.serializeInnerClasses && isInnerClass(cls)) || isAnonymousOrNonStaticLocal(cls);
}
return true;
}
public boolean excludeClass(Class<?> cls, boolean z) {
return excludeClassChecks(cls) || excludeClassInStrategy(cls, z);
}
private boolean excludeClassInStrategy(Class<?> cls, boolean z) {
Iterator<ExclusionStrategy> it = (z ? this.serializationStrategies : this.deserializationStrategies).iterator();
while (it.hasNext()) {
if (it.next().shouldSkipClass(cls)) {
return true;
}
}
return false;
}
private boolean isAnonymousOrNonStaticLocal(Class<?> cls) {
return (Enum.class.isAssignableFrom(cls) || isStatic(cls) || (!cls.isAnonymousClass() && !cls.isLocalClass())) ? false : true;
}
private boolean isInnerClass(Class<?> cls) {
return cls.isMemberClass() && !isStatic(cls);
}
private boolean isStatic(Class<?> cls) {
return (cls.getModifiers() & 8) != 0;
}
private boolean isValidVersion(Since since, Until until) {
return isValidSince(since) && isValidUntil(until);
}
private boolean isValidSince(Since since) {
return since == null || since.value() <= this.version;
}
private boolean isValidUntil(Until until) {
return until == null || until.value() > this.version;
}
}

View File

@@ -0,0 +1,9 @@
package com.google.gson.internal;
/* loaded from: classes3.dex */
public final class GsonBuildConfig {
public static final String VERSION = "2.8.9";
private GsonBuildConfig() {
}
}

View File

@@ -0,0 +1,58 @@
package com.google.gson.internal;
/* loaded from: classes3.dex */
public final class JavaVersion {
private static final int majorJavaVersion = determineMajorJavaVersion();
public static int getMajorJavaVersion() {
return majorJavaVersion;
}
public static boolean isJava9OrLater() {
return majorJavaVersion >= 9;
}
private static int determineMajorJavaVersion() {
return getMajorJavaVersion(System.getProperty("java.version"));
}
public static int getMajorJavaVersion(String str) {
int parseDotted = parseDotted(str);
if (parseDotted == -1) {
parseDotted = extractBeginningInt(str);
}
if (parseDotted == -1) {
return 6;
}
return parseDotted;
}
private static int parseDotted(String str) {
try {
String[] split = str.split("[._]");
int parseInt = Integer.parseInt(split[0]);
return (parseInt != 1 || split.length <= 1) ? parseInt : Integer.parseInt(split[1]);
} catch (NumberFormatException unused) {
return -1;
}
}
private static int extractBeginningInt(String str) {
try {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
char charAt = str.charAt(i);
if (!Character.isDigit(charAt)) {
break;
}
sb.append(charAt);
}
return Integer.parseInt(sb.toString());
} catch (NumberFormatException unused) {
return -1;
}
}
private JavaVersion() {
}
}

View File

@@ -0,0 +1,11 @@
package com.google.gson.internal;
import com.google.gson.stream.JsonReader;
import java.io.IOException;
/* loaded from: classes3.dex */
public abstract class JsonReaderInternalAccess {
public static JsonReaderInternalAccess INSTANCE;
public abstract void promoteNameToValue(JsonReader jsonReader) throws IOException;
}

View File

@@ -0,0 +1,76 @@
package com.google.gson.internal;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamException;
import java.math.BigDecimal;
/* loaded from: classes3.dex */
public final class LazilyParsedNumber extends Number {
private final String value;
public String toString() {
return this.value;
}
public LazilyParsedNumber(String str) {
this.value = str;
}
@Override // java.lang.Number
public int intValue() {
try {
try {
return Integer.parseInt(this.value);
} catch (NumberFormatException unused) {
return (int) Long.parseLong(this.value);
}
} catch (NumberFormatException unused2) {
return new BigDecimal(this.value).intValue();
}
}
@Override // java.lang.Number
public long longValue() {
try {
return Long.parseLong(this.value);
} catch (NumberFormatException unused) {
return new BigDecimal(this.value).longValue();
}
}
@Override // java.lang.Number
public float floatValue() {
return Float.parseFloat(this.value);
}
@Override // java.lang.Number
public double doubleValue() {
return Double.parseDouble(this.value);
}
private Object writeReplace() throws ObjectStreamException {
return new BigDecimal(this.value);
}
private void readObject(ObjectInputStream objectInputStream) throws IOException {
throw new InvalidObjectException("Deserialization is unsupported");
}
public int hashCode() {
return this.value.hashCode();
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof LazilyParsedNumber)) {
return false;
}
String str = this.value;
String str2 = ((LazilyParsedNumber) obj).value;
return str == str2 || str.equals(str2);
}
}

View File

@@ -0,0 +1,771 @@
package com.google.gson.internal;
import com.ironsource.v8;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Arrays;
import java.util.Comparator;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
/* loaded from: classes3.dex */
public final class LinkedHashTreeMap<K, V> extends AbstractMap<K, V> implements Serializable {
static final /* synthetic */ boolean $assertionsDisabled = false;
private static final Comparator<Comparable> NATURAL_ORDER = new Comparator<Comparable>() { // from class: com.google.gson.internal.LinkedHashTreeMap.1
@Override // java.util.Comparator
public int compare(Comparable comparable, Comparable comparable2) {
return comparable.compareTo(comparable2);
}
};
Comparator<? super K> comparator;
private LinkedHashTreeMap<K, V>.EntrySet entrySet;
final Node<K, V> header;
private LinkedHashTreeMap<K, V>.KeySet keySet;
int modCount;
int size;
Node<K, V>[] table;
int threshold;
private static int secondaryHash(int i) {
int i2 = i ^ ((i >>> 20) ^ (i >>> 12));
return (i2 >>> 4) ^ ((i2 >>> 7) ^ i2);
}
@Override // java.util.AbstractMap, java.util.Map
public int size() {
return this.size;
}
public LinkedHashTreeMap() {
this(NATURAL_ORDER);
}
public LinkedHashTreeMap(Comparator<? super K> comparator) {
this.size = 0;
this.modCount = 0;
this.comparator = comparator == null ? NATURAL_ORDER : comparator;
this.header = new Node<>();
Node<K, V>[] nodeArr = new Node[16];
this.table = nodeArr;
this.threshold = (nodeArr.length / 2) + (nodeArr.length / 4);
}
@Override // java.util.AbstractMap, java.util.Map
public V get(Object obj) {
Node<K, V> findByObject = findByObject(obj);
if (findByObject != null) {
return findByObject.value;
}
return null;
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
return findByObject(obj) != null;
}
@Override // java.util.AbstractMap, java.util.Map
public V put(K k, V v) {
if (k == null) {
throw new NullPointerException("key == null");
}
Node<K, V> find = find(k, true);
V v2 = find.value;
find.value = v;
return v2;
}
@Override // java.util.AbstractMap, java.util.Map
public void clear() {
Arrays.fill(this.table, (Object) null);
this.size = 0;
this.modCount++;
Node<K, V> node = this.header;
Node<K, V> node2 = node.next;
while (node2 != node) {
Node<K, V> node3 = node2.next;
node2.prev = null;
node2.next = null;
node2 = node3;
}
node.prev = node;
node.next = node;
}
@Override // java.util.AbstractMap, java.util.Map
public V remove(Object obj) {
Node<K, V> removeInternalByKey = removeInternalByKey(obj);
if (removeInternalByKey != null) {
return removeInternalByKey.value;
}
return null;
}
public Node<K, V> find(K k, boolean z) {
int i;
Node<K, V> node;
Comparator<? super K> comparator = this.comparator;
Node<K, V>[] nodeArr = this.table;
int secondaryHash = secondaryHash(k.hashCode());
int length = (nodeArr.length - 1) & secondaryHash;
Node<K, V> node2 = nodeArr[length];
if (node2 != null) {
Comparable comparable = comparator == NATURAL_ORDER ? (Comparable) k : null;
while (true) {
if (comparable != null) {
i = comparable.compareTo(node2.key);
} else {
i = comparator.compare(k, node2.key);
}
if (i == 0) {
return node2;
}
Node<K, V> node3 = i < 0 ? node2.left : node2.right;
if (node3 == null) {
break;
}
node2 = node3;
}
} else {
i = 0;
}
Node<K, V> node4 = node2;
int i2 = i;
if (!z) {
return null;
}
Node<K, V> node5 = this.header;
if (node4 == null) {
if (comparator == NATURAL_ORDER && !(k instanceof Comparable)) {
throw new ClassCastException(k.getClass().getName() + " is not Comparable");
}
node = new Node<>(node4, k, secondaryHash, node5, node5.prev);
nodeArr[length] = node;
} else {
node = new Node<>(node4, k, secondaryHash, node5, node5.prev);
if (i2 < 0) {
node4.left = node;
} else {
node4.right = node;
}
rebalance(node4, true);
}
int i3 = this.size;
this.size = i3 + 1;
if (i3 > this.threshold) {
doubleCapacity();
}
this.modCount++;
return node;
}
/* JADX WARN: Multi-variable type inference failed */
public Node<K, V> findByObject(Object obj) {
if (obj == 0) {
return null;
}
try {
return find(obj, false);
} catch (ClassCastException unused) {
return null;
}
}
public Node<K, V> findByEntry(Map.Entry<?, ?> entry) {
Node<K, V> findByObject = findByObject(entry.getKey());
if (findByObject == null || !equal(findByObject.value, entry.getValue())) {
return null;
}
return findByObject;
}
private boolean equal(Object obj, Object obj2) {
return obj == obj2 || (obj != null && obj.equals(obj2));
}
public void removeInternal(Node<K, V> node, boolean z) {
int i;
if (z) {
Node<K, V> node2 = node.prev;
node2.next = node.next;
node.next.prev = node2;
node.prev = null;
node.next = null;
}
Node<K, V> node3 = node.left;
Node<K, V> node4 = node.right;
Node<K, V> node5 = node.parent;
int i2 = 0;
if (node3 != null && node4 != null) {
Node<K, V> last = node3.height > node4.height ? node3.last() : node4.first();
removeInternal(last, false);
Node<K, V> node6 = node.left;
if (node6 != null) {
i = node6.height;
last.left = node6;
node6.parent = last;
node.left = null;
} else {
i = 0;
}
Node<K, V> node7 = node.right;
if (node7 != null) {
i2 = node7.height;
last.right = node7;
node7.parent = last;
node.right = null;
}
last.height = Math.max(i, i2) + 1;
replaceInParent(node, last);
return;
}
if (node3 != null) {
replaceInParent(node, node3);
node.left = null;
} else if (node4 != null) {
replaceInParent(node, node4);
node.right = null;
} else {
replaceInParent(node, null);
}
rebalance(node5, false);
this.size--;
this.modCount++;
}
public Node<K, V> removeInternalByKey(Object obj) {
Node<K, V> findByObject = findByObject(obj);
if (findByObject != null) {
removeInternal(findByObject, true);
}
return findByObject;
}
private void replaceInParent(Node<K, V> node, Node<K, V> node2) {
Node<K, V> node3 = node.parent;
node.parent = null;
if (node2 != null) {
node2.parent = node3;
}
if (node3 != null) {
if (node3.left == node) {
node3.left = node2;
return;
} else {
node3.right = node2;
return;
}
}
int i = node.hash;
this.table[i & (r0.length - 1)] = node2;
}
private void rebalance(Node<K, V> node, boolean z) {
while (node != null) {
Node<K, V> node2 = node.left;
Node<K, V> node3 = node.right;
int i = node2 != null ? node2.height : 0;
int i2 = node3 != null ? node3.height : 0;
int i3 = i - i2;
if (i3 == -2) {
Node<K, V> node4 = node3.left;
Node<K, V> node5 = node3.right;
int i4 = (node4 != null ? node4.height : 0) - (node5 != null ? node5.height : 0);
if (i4 == -1 || (i4 == 0 && !z)) {
rotateLeft(node);
} else {
rotateRight(node3);
rotateLeft(node);
}
if (z) {
return;
}
} else if (i3 == 2) {
Node<K, V> node6 = node2.left;
Node<K, V> node7 = node2.right;
int i5 = (node6 != null ? node6.height : 0) - (node7 != null ? node7.height : 0);
if (i5 == 1 || (i5 == 0 && !z)) {
rotateRight(node);
} else {
rotateLeft(node2);
rotateRight(node);
}
if (z) {
return;
}
} else if (i3 == 0) {
node.height = i + 1;
if (z) {
return;
}
} else {
node.height = Math.max(i, i2) + 1;
if (!z) {
return;
}
}
node = node.parent;
}
}
private void rotateLeft(Node<K, V> node) {
Node<K, V> node2 = node.left;
Node<K, V> node3 = node.right;
Node<K, V> node4 = node3.left;
Node<K, V> node5 = node3.right;
node.right = node4;
if (node4 != null) {
node4.parent = node;
}
replaceInParent(node, node3);
node3.left = node;
node.parent = node3;
int max = Math.max(node2 != null ? node2.height : 0, node4 != null ? node4.height : 0) + 1;
node.height = max;
node3.height = Math.max(max, node5 != null ? node5.height : 0) + 1;
}
private void rotateRight(Node<K, V> node) {
Node<K, V> node2 = node.left;
Node<K, V> node3 = node.right;
Node<K, V> node4 = node2.left;
Node<K, V> node5 = node2.right;
node.left = node5;
if (node5 != null) {
node5.parent = node;
}
replaceInParent(node, node2);
node2.right = node;
node.parent = node2;
int max = Math.max(node3 != null ? node3.height : 0, node5 != null ? node5.height : 0) + 1;
node.height = max;
node2.height = Math.max(max, node4 != null ? node4.height : 0) + 1;
}
@Override // java.util.AbstractMap, java.util.Map
public Set<Map.Entry<K, V>> entrySet() {
LinkedHashTreeMap<K, V>.EntrySet entrySet = this.entrySet;
if (entrySet != null) {
return entrySet;
}
LinkedHashTreeMap<K, V>.EntrySet entrySet2 = new EntrySet();
this.entrySet = entrySet2;
return entrySet2;
}
@Override // java.util.AbstractMap, java.util.Map
public Set<K> keySet() {
LinkedHashTreeMap<K, V>.KeySet keySet = this.keySet;
if (keySet != null) {
return keySet;
}
LinkedHashTreeMap<K, V>.KeySet keySet2 = new KeySet();
this.keySet = keySet2;
return keySet2;
}
public static final class Node<K, V> implements Map.Entry<K, V> {
final int hash;
int height;
final K key;
Node<K, V> left;
Node<K, V> next;
Node<K, V> parent;
Node<K, V> prev;
Node<K, V> right;
V value;
@Override // java.util.Map.Entry
public K getKey() {
return this.key;
}
@Override // java.util.Map.Entry
public V getValue() {
return this.value;
}
@Override // java.util.Map.Entry
public V setValue(V v) {
V v2 = this.value;
this.value = v;
return v2;
}
public Node() {
this.key = null;
this.hash = -1;
this.prev = this;
this.next = this;
}
public Node(Node<K, V> node, K k, int i, Node<K, V> node2, Node<K, V> node3) {
this.parent = node;
this.key = k;
this.hash = i;
this.height = 1;
this.next = node2;
this.prev = node3;
node3.next = this;
node2.prev = this;
}
@Override // java.util.Map.Entry
public boolean equals(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
K k = this.key;
if (k == null) {
if (entry.getKey() != null) {
return false;
}
} else if (!k.equals(entry.getKey())) {
return false;
}
V v = this.value;
if (v == null) {
if (entry.getValue() != null) {
return false;
}
} else if (!v.equals(entry.getValue())) {
return false;
}
return true;
}
@Override // java.util.Map.Entry
public int hashCode() {
K k = this.key;
int hashCode = k == null ? 0 : k.hashCode();
V v = this.value;
return hashCode ^ (v != null ? v.hashCode() : 0);
}
public String toString() {
return this.key + v8.i.b + this.value;
}
public Node<K, V> first() {
Node<K, V> node = this;
for (Node<K, V> node2 = this.left; node2 != null; node2 = node2.left) {
node = node2;
}
return node;
}
public Node<K, V> last() {
Node<K, V> node = this;
for (Node<K, V> node2 = this.right; node2 != null; node2 = node2.right) {
node = node2;
}
return node;
}
}
private void doubleCapacity() {
Node<K, V>[] doubleCapacity = doubleCapacity(this.table);
this.table = doubleCapacity;
this.threshold = (doubleCapacity.length / 2) + (doubleCapacity.length / 4);
}
public static <K, V> Node<K, V>[] doubleCapacity(Node<K, V>[] nodeArr) {
int length = nodeArr.length;
Node<K, V>[] nodeArr2 = new Node[length * 2];
AvlIterator avlIterator = new AvlIterator();
AvlBuilder avlBuilder = new AvlBuilder();
AvlBuilder avlBuilder2 = new AvlBuilder();
for (int i = 0; i < length; i++) {
Node<K, V> node = nodeArr[i];
if (node != null) {
avlIterator.reset(node);
int i2 = 0;
int i3 = 0;
while (true) {
Node<K, V> next = avlIterator.next();
if (next == null) {
break;
}
if ((next.hash & length) == 0) {
i2++;
} else {
i3++;
}
}
avlBuilder.reset(i2);
avlBuilder2.reset(i3);
avlIterator.reset(node);
while (true) {
Node<K, V> next2 = avlIterator.next();
if (next2 == null) {
break;
}
if ((next2.hash & length) == 0) {
avlBuilder.add(next2);
} else {
avlBuilder2.add(next2);
}
}
nodeArr2[i] = i2 > 0 ? avlBuilder.root() : null;
nodeArr2[i + length] = i3 > 0 ? avlBuilder2.root() : null;
}
}
return nodeArr2;
}
public static class AvlIterator<K, V> {
private Node<K, V> stackTop;
public void reset(Node<K, V> node) {
Node<K, V> node2 = null;
while (node != null) {
node.parent = node2;
node2 = node;
node = node.left;
}
this.stackTop = node2;
}
public Node<K, V> next() {
Node<K, V> node = this.stackTop;
if (node == null) {
return null;
}
Node<K, V> node2 = node.parent;
node.parent = null;
Node<K, V> node3 = node.right;
while (true) {
Node<K, V> node4 = node2;
node2 = node3;
if (node2 == null) {
this.stackTop = node4;
return node;
}
node2.parent = node4;
node3 = node2.left;
}
}
}
public static final class AvlBuilder<K, V> {
private int leavesSkipped;
private int leavesToSkip;
private int size;
private Node<K, V> stack;
public void reset(int i) {
this.leavesToSkip = ((Integer.highestOneBit(i) * 2) - 1) - i;
this.size = 0;
this.leavesSkipped = 0;
this.stack = null;
}
public void add(Node<K, V> node) {
node.right = null;
node.parent = null;
node.left = null;
node.height = 1;
int i = this.leavesToSkip;
if (i > 0) {
int i2 = this.size;
if ((i2 & 1) == 0) {
this.size = i2 + 1;
this.leavesToSkip = i - 1;
this.leavesSkipped++;
}
}
node.parent = this.stack;
this.stack = node;
int i3 = this.size;
int i4 = i3 + 1;
this.size = i4;
int i5 = this.leavesToSkip;
if (i5 > 0 && (i4 & 1) == 0) {
this.size = i3 + 2;
this.leavesToSkip = i5 - 1;
this.leavesSkipped++;
}
int i6 = 4;
while (true) {
int i7 = i6 - 1;
if ((this.size & i7) != i7) {
return;
}
int i8 = this.leavesSkipped;
if (i8 == 0) {
Node<K, V> node2 = this.stack;
Node<K, V> node3 = node2.parent;
Node<K, V> node4 = node3.parent;
node3.parent = node4.parent;
this.stack = node3;
node3.left = node4;
node3.right = node2;
node3.height = node2.height + 1;
node4.parent = node3;
node2.parent = node3;
} else if (i8 == 1) {
Node<K, V> node5 = this.stack;
Node<K, V> node6 = node5.parent;
this.stack = node6;
node6.right = node5;
node6.height = node5.height + 1;
node5.parent = node6;
this.leavesSkipped = 0;
} else if (i8 == 2) {
this.leavesSkipped = 0;
}
i6 *= 2;
}
}
public Node<K, V> root() {
Node<K, V> node = this.stack;
if (node.parent == null) {
return node;
}
throw new IllegalStateException();
}
}
public abstract class LinkedTreeMapIterator<T> implements Iterator<T> {
int expectedModCount;
Node<K, V> lastReturned = null;
Node<K, V> next;
public LinkedTreeMapIterator() {
this.next = LinkedHashTreeMap.this.header.next;
this.expectedModCount = LinkedHashTreeMap.this.modCount;
}
@Override // java.util.Iterator
public final boolean hasNext() {
return this.next != LinkedHashTreeMap.this.header;
}
public final Node<K, V> nextNode() {
Node<K, V> node = this.next;
LinkedHashTreeMap linkedHashTreeMap = LinkedHashTreeMap.this;
if (node == linkedHashTreeMap.header) {
throw new NoSuchElementException();
}
if (linkedHashTreeMap.modCount != this.expectedModCount) {
throw new ConcurrentModificationException();
}
this.next = node.next;
this.lastReturned = node;
return node;
}
@Override // java.util.Iterator
public final void remove() {
Node<K, V> node = this.lastReturned;
if (node == null) {
throw new IllegalStateException();
}
LinkedHashTreeMap.this.removeInternal(node, true);
this.lastReturned = null;
this.expectedModCount = LinkedHashTreeMap.this.modCount;
}
}
public final class EntrySet extends AbstractSet<Map.Entry<K, V>> {
public EntrySet() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return LinkedHashTreeMap.this.size;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Map.Entry<K, V>> iterator() {
return new LinkedHashTreeMap<K, V>.LinkedTreeMapIterator<Map.Entry<K, V>>() { // from class: com.google.gson.internal.LinkedHashTreeMap.EntrySet.1
{
LinkedHashTreeMap linkedHashTreeMap = LinkedHashTreeMap.this;
}
@Override // java.util.Iterator
public Map.Entry<K, V> next() {
return nextNode();
}
};
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return (obj instanceof Map.Entry) && LinkedHashTreeMap.this.findByEntry((Map.Entry) obj) != null;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
Node<K, V> findByEntry;
if (!(obj instanceof Map.Entry) || (findByEntry = LinkedHashTreeMap.this.findByEntry((Map.Entry) obj)) == null) {
return false;
}
LinkedHashTreeMap.this.removeInternal(findByEntry, true);
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
LinkedHashTreeMap.this.clear();
}
}
public final class KeySet extends AbstractSet<K> {
public KeySet() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return LinkedHashTreeMap.this.size;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<K> iterator() {
return new LinkedHashTreeMap<K, V>.LinkedTreeMapIterator<K>() { // from class: com.google.gson.internal.LinkedHashTreeMap.KeySet.1
{
LinkedHashTreeMap linkedHashTreeMap = LinkedHashTreeMap.this;
}
@Override // java.util.Iterator
public K next() {
return nextNode().key;
}
};
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return LinkedHashTreeMap.this.containsKey(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
return LinkedHashTreeMap.this.removeInternalByKey(obj) != null;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
LinkedHashTreeMap.this.clear();
}
}
private Object writeReplace() throws ObjectStreamException {
return new LinkedHashMap(this);
}
private void readObject(ObjectInputStream objectInputStream) throws IOException {
throw new InvalidObjectException("Deserialization is unsupported");
}
}

View File

@@ -0,0 +1,572 @@
package com.google.gson.internal;
import com.ironsource.v8;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Comparator;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
/* loaded from: classes3.dex */
public final class LinkedTreeMap<K, V> extends AbstractMap<K, V> implements Serializable {
static final /* synthetic */ boolean $assertionsDisabled = false;
private static final Comparator<Comparable> NATURAL_ORDER = new Comparator<Comparable>() { // from class: com.google.gson.internal.LinkedTreeMap.1
@Override // java.util.Comparator
public int compare(Comparable comparable, Comparable comparable2) {
return comparable.compareTo(comparable2);
}
};
Comparator<? super K> comparator;
private LinkedTreeMap<K, V>.EntrySet entrySet;
final Node<K, V> header;
private LinkedTreeMap<K, V>.KeySet keySet;
int modCount;
Node<K, V> root;
int size;
@Override // java.util.AbstractMap, java.util.Map
public int size() {
return this.size;
}
public LinkedTreeMap() {
this(NATURAL_ORDER);
}
public LinkedTreeMap(Comparator<? super K> comparator) {
this.size = 0;
this.modCount = 0;
this.header = new Node<>();
this.comparator = comparator == null ? NATURAL_ORDER : comparator;
}
@Override // java.util.AbstractMap, java.util.Map
public V get(Object obj) {
Node<K, V> findByObject = findByObject(obj);
if (findByObject != null) {
return findByObject.value;
}
return null;
}
@Override // java.util.AbstractMap, java.util.Map
public boolean containsKey(Object obj) {
return findByObject(obj) != null;
}
@Override // java.util.AbstractMap, java.util.Map
public V put(K k, V v) {
if (k == null) {
throw new NullPointerException("key == null");
}
Node<K, V> find = find(k, true);
V v2 = find.value;
find.value = v;
return v2;
}
@Override // java.util.AbstractMap, java.util.Map
public void clear() {
this.root = null;
this.size = 0;
this.modCount++;
Node<K, V> node = this.header;
node.prev = node;
node.next = node;
}
@Override // java.util.AbstractMap, java.util.Map
public V remove(Object obj) {
Node<K, V> removeInternalByKey = removeInternalByKey(obj);
if (removeInternalByKey != null) {
return removeInternalByKey.value;
}
return null;
}
public Node<K, V> find(K k, boolean z) {
int i;
Node<K, V> node;
Comparator<? super K> comparator = this.comparator;
Node<K, V> node2 = this.root;
if (node2 != null) {
Comparable comparable = comparator == NATURAL_ORDER ? (Comparable) k : null;
while (true) {
if (comparable != null) {
i = comparable.compareTo(node2.key);
} else {
i = comparator.compare(k, node2.key);
}
if (i == 0) {
return node2;
}
Node<K, V> node3 = i < 0 ? node2.left : node2.right;
if (node3 == null) {
break;
}
node2 = node3;
}
} else {
i = 0;
}
if (!z) {
return null;
}
Node<K, V> node4 = this.header;
if (node2 == null) {
if (comparator == NATURAL_ORDER && !(k instanceof Comparable)) {
throw new ClassCastException(k.getClass().getName() + " is not Comparable");
}
node = new Node<>(node2, k, node4, node4.prev);
this.root = node;
} else {
node = new Node<>(node2, k, node4, node4.prev);
if (i < 0) {
node2.left = node;
} else {
node2.right = node;
}
rebalance(node2, true);
}
this.size++;
this.modCount++;
return node;
}
/* JADX WARN: Multi-variable type inference failed */
public Node<K, V> findByObject(Object obj) {
if (obj == 0) {
return null;
}
try {
return find(obj, false);
} catch (ClassCastException unused) {
return null;
}
}
public Node<K, V> findByEntry(Map.Entry<?, ?> entry) {
Node<K, V> findByObject = findByObject(entry.getKey());
if (findByObject == null || !equal(findByObject.value, entry.getValue())) {
return null;
}
return findByObject;
}
private boolean equal(Object obj, Object obj2) {
return obj == obj2 || (obj != null && obj.equals(obj2));
}
public void removeInternal(Node<K, V> node, boolean z) {
int i;
if (z) {
Node<K, V> node2 = node.prev;
node2.next = node.next;
node.next.prev = node2;
}
Node<K, V> node3 = node.left;
Node<K, V> node4 = node.right;
Node<K, V> node5 = node.parent;
int i2 = 0;
if (node3 != null && node4 != null) {
Node<K, V> last = node3.height > node4.height ? node3.last() : node4.first();
removeInternal(last, false);
Node<K, V> node6 = node.left;
if (node6 != null) {
i = node6.height;
last.left = node6;
node6.parent = last;
node.left = null;
} else {
i = 0;
}
Node<K, V> node7 = node.right;
if (node7 != null) {
i2 = node7.height;
last.right = node7;
node7.parent = last;
node.right = null;
}
last.height = Math.max(i, i2) + 1;
replaceInParent(node, last);
return;
}
if (node3 != null) {
replaceInParent(node, node3);
node.left = null;
} else if (node4 != null) {
replaceInParent(node, node4);
node.right = null;
} else {
replaceInParent(node, null);
}
rebalance(node5, false);
this.size--;
this.modCount++;
}
public Node<K, V> removeInternalByKey(Object obj) {
Node<K, V> findByObject = findByObject(obj);
if (findByObject != null) {
removeInternal(findByObject, true);
}
return findByObject;
}
private void replaceInParent(Node<K, V> node, Node<K, V> node2) {
Node<K, V> node3 = node.parent;
node.parent = null;
if (node2 != null) {
node2.parent = node3;
}
if (node3 == null) {
this.root = node2;
} else if (node3.left == node) {
node3.left = node2;
} else {
node3.right = node2;
}
}
private void rebalance(Node<K, V> node, boolean z) {
while (node != null) {
Node<K, V> node2 = node.left;
Node<K, V> node3 = node.right;
int i = node2 != null ? node2.height : 0;
int i2 = node3 != null ? node3.height : 0;
int i3 = i - i2;
if (i3 == -2) {
Node<K, V> node4 = node3.left;
Node<K, V> node5 = node3.right;
int i4 = (node4 != null ? node4.height : 0) - (node5 != null ? node5.height : 0);
if (i4 == -1 || (i4 == 0 && !z)) {
rotateLeft(node);
} else {
rotateRight(node3);
rotateLeft(node);
}
if (z) {
return;
}
} else if (i3 == 2) {
Node<K, V> node6 = node2.left;
Node<K, V> node7 = node2.right;
int i5 = (node6 != null ? node6.height : 0) - (node7 != null ? node7.height : 0);
if (i5 == 1 || (i5 == 0 && !z)) {
rotateRight(node);
} else {
rotateLeft(node2);
rotateRight(node);
}
if (z) {
return;
}
} else if (i3 == 0) {
node.height = i + 1;
if (z) {
return;
}
} else {
node.height = Math.max(i, i2) + 1;
if (!z) {
return;
}
}
node = node.parent;
}
}
private void rotateLeft(Node<K, V> node) {
Node<K, V> node2 = node.left;
Node<K, V> node3 = node.right;
Node<K, V> node4 = node3.left;
Node<K, V> node5 = node3.right;
node.right = node4;
if (node4 != null) {
node4.parent = node;
}
replaceInParent(node, node3);
node3.left = node;
node.parent = node3;
int max = Math.max(node2 != null ? node2.height : 0, node4 != null ? node4.height : 0) + 1;
node.height = max;
node3.height = Math.max(max, node5 != null ? node5.height : 0) + 1;
}
private void rotateRight(Node<K, V> node) {
Node<K, V> node2 = node.left;
Node<K, V> node3 = node.right;
Node<K, V> node4 = node2.left;
Node<K, V> node5 = node2.right;
node.left = node5;
if (node5 != null) {
node5.parent = node;
}
replaceInParent(node, node2);
node2.right = node;
node.parent = node2;
int max = Math.max(node3 != null ? node3.height : 0, node5 != null ? node5.height : 0) + 1;
node.height = max;
node2.height = Math.max(max, node4 != null ? node4.height : 0) + 1;
}
@Override // java.util.AbstractMap, java.util.Map
public Set<Map.Entry<K, V>> entrySet() {
LinkedTreeMap<K, V>.EntrySet entrySet = this.entrySet;
if (entrySet != null) {
return entrySet;
}
LinkedTreeMap<K, V>.EntrySet entrySet2 = new EntrySet();
this.entrySet = entrySet2;
return entrySet2;
}
@Override // java.util.AbstractMap, java.util.Map
public Set<K> keySet() {
LinkedTreeMap<K, V>.KeySet keySet = this.keySet;
if (keySet != null) {
return keySet;
}
LinkedTreeMap<K, V>.KeySet keySet2 = new KeySet();
this.keySet = keySet2;
return keySet2;
}
public static final class Node<K, V> implements Map.Entry<K, V> {
int height;
final K key;
Node<K, V> left;
Node<K, V> next;
Node<K, V> parent;
Node<K, V> prev;
Node<K, V> right;
V value;
@Override // java.util.Map.Entry
public K getKey() {
return this.key;
}
@Override // java.util.Map.Entry
public V getValue() {
return this.value;
}
@Override // java.util.Map.Entry
public V setValue(V v) {
V v2 = this.value;
this.value = v;
return v2;
}
public Node() {
this.key = null;
this.prev = this;
this.next = this;
}
public Node(Node<K, V> node, K k, Node<K, V> node2, Node<K, V> node3) {
this.parent = node;
this.key = k;
this.height = 1;
this.next = node2;
this.prev = node3;
node3.next = this;
node2.prev = this;
}
@Override // java.util.Map.Entry
public boolean equals(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
K k = this.key;
if (k == null) {
if (entry.getKey() != null) {
return false;
}
} else if (!k.equals(entry.getKey())) {
return false;
}
V v = this.value;
if (v == null) {
if (entry.getValue() != null) {
return false;
}
} else if (!v.equals(entry.getValue())) {
return false;
}
return true;
}
@Override // java.util.Map.Entry
public int hashCode() {
K k = this.key;
int hashCode = k == null ? 0 : k.hashCode();
V v = this.value;
return hashCode ^ (v != null ? v.hashCode() : 0);
}
public String toString() {
return this.key + v8.i.b + this.value;
}
public Node<K, V> first() {
Node<K, V> node = this;
for (Node<K, V> node2 = this.left; node2 != null; node2 = node2.left) {
node = node2;
}
return node;
}
public Node<K, V> last() {
Node<K, V> node = this;
for (Node<K, V> node2 = this.right; node2 != null; node2 = node2.right) {
node = node2;
}
return node;
}
}
public abstract class LinkedTreeMapIterator<T> implements Iterator<T> {
int expectedModCount;
Node<K, V> lastReturned = null;
Node<K, V> next;
public LinkedTreeMapIterator() {
this.next = LinkedTreeMap.this.header.next;
this.expectedModCount = LinkedTreeMap.this.modCount;
}
@Override // java.util.Iterator
public final boolean hasNext() {
return this.next != LinkedTreeMap.this.header;
}
public final Node<K, V> nextNode() {
Node<K, V> node = this.next;
LinkedTreeMap linkedTreeMap = LinkedTreeMap.this;
if (node == linkedTreeMap.header) {
throw new NoSuchElementException();
}
if (linkedTreeMap.modCount != this.expectedModCount) {
throw new ConcurrentModificationException();
}
this.next = node.next;
this.lastReturned = node;
return node;
}
@Override // java.util.Iterator
public final void remove() {
Node<K, V> node = this.lastReturned;
if (node == null) {
throw new IllegalStateException();
}
LinkedTreeMap.this.removeInternal(node, true);
this.lastReturned = null;
this.expectedModCount = LinkedTreeMap.this.modCount;
}
}
public class EntrySet extends AbstractSet<Map.Entry<K, V>> {
public EntrySet() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return LinkedTreeMap.this.size;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<Map.Entry<K, V>> iterator() {
return new LinkedTreeMap<K, V>.LinkedTreeMapIterator<Map.Entry<K, V>>() { // from class: com.google.gson.internal.LinkedTreeMap.EntrySet.1
{
LinkedTreeMap linkedTreeMap = LinkedTreeMap.this;
}
@Override // java.util.Iterator
public Map.Entry<K, V> next() {
return nextNode();
}
};
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return (obj instanceof Map.Entry) && LinkedTreeMap.this.findByEntry((Map.Entry) obj) != null;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
Node<K, V> findByEntry;
if (!(obj instanceof Map.Entry) || (findByEntry = LinkedTreeMap.this.findByEntry((Map.Entry) obj)) == null) {
return false;
}
LinkedTreeMap.this.removeInternal(findByEntry, true);
return true;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
LinkedTreeMap.this.clear();
}
}
public final class KeySet extends AbstractSet<K> {
public KeySet() {
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public int size() {
return LinkedTreeMap.this.size;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<K> iterator() {
return new LinkedTreeMap<K, V>.LinkedTreeMapIterator<K>() { // from class: com.google.gson.internal.LinkedTreeMap.KeySet.1
{
LinkedTreeMap linkedTreeMap = LinkedTreeMap.this;
}
@Override // java.util.Iterator
public K next() {
return nextNode().key;
}
};
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean contains(Object obj) {
return LinkedTreeMap.this.containsKey(obj);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public boolean remove(Object obj) {
return LinkedTreeMap.this.removeInternalByKey(obj) != null;
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
public void clear() {
LinkedTreeMap.this.clear();
}
}
private Object writeReplace() throws ObjectStreamException {
return new LinkedHashMap(this);
}
private void readObject(ObjectInputStream objectInputStream) throws IOException {
throw new InvalidObjectException("Deserialization is unsupported");
}
}

View File

@@ -0,0 +1,6 @@
package com.google.gson.internal;
/* loaded from: classes3.dex */
public interface ObjectConstructor<T> {
T construct();
}

View File

@@ -0,0 +1,61 @@
package com.google.gson.internal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;
/* loaded from: classes3.dex */
public class PreJava9DateFormatProvider {
public static DateFormat getUSDateFormat(int i) {
return new SimpleDateFormat(getDateFormatPattern(i), Locale.US);
}
public static DateFormat getUSDateTimeFormat(int i, int i2) {
return new SimpleDateFormat(getDatePartOfDateTimePattern(i) + " " + getTimePartOfDateTimePattern(i2), Locale.US);
}
private static String getDateFormatPattern(int i) {
if (i == 0) {
return "EEEE, MMMM d, y";
}
if (i == 1) {
return "MMMM d, y";
}
if (i == 2) {
return "MMM d, y";
}
if (i == 3) {
return "M/d/yy";
}
throw new IllegalArgumentException("Unknown DateFormat style: " + i);
}
private static String getDatePartOfDateTimePattern(int i) {
if (i == 0) {
return "EEEE, MMMM d, yyyy";
}
if (i == 1) {
return "MMMM d, yyyy";
}
if (i == 2) {
return "MMM d, yyyy";
}
if (i == 3) {
return "M/d/yy";
}
throw new IllegalArgumentException("Unknown DateFormat style: " + i);
}
private static String getTimePartOfDateTimePattern(int i) {
if (i == 0 || i == 1) {
return "h:mm:ss a z";
}
if (i == 2) {
return "h:mm:ss a";
}
if (i == 3) {
return "h:mm a";
}
throw new IllegalArgumentException("Unknown DateFormat style: " + i);
}
}

View File

@@ -0,0 +1,25 @@
package com.google.gson.internal;
import java.lang.reflect.Type;
/* loaded from: classes3.dex */
public final class Primitives {
public static boolean isWrapperType(Type type) {
return type == Integer.class || type == Float.class || type == Byte.class || type == Double.class || type == Long.class || type == Character.class || type == Boolean.class || type == Short.class || type == Void.class;
}
public static <T> Class<T> unwrap(Class<T> cls) {
return cls == Integer.class ? Integer.TYPE : cls == Float.class ? Float.TYPE : cls == Byte.class ? Byte.TYPE : cls == Double.class ? Double.TYPE : cls == Long.class ? Long.TYPE : cls == Character.class ? Character.TYPE : cls == Boolean.class ? Boolean.TYPE : cls == Short.class ? Short.TYPE : cls == Void.class ? Void.TYPE : cls;
}
public static <T> Class<T> wrap(Class<T> cls) {
return cls == Integer.TYPE ? Integer.class : cls == Float.TYPE ? Float.class : cls == Byte.TYPE ? Byte.class : cls == Double.TYPE ? Double.class : cls == Long.TYPE ? Long.class : cls == Character.TYPE ? Character.class : cls == Boolean.TYPE ? Boolean.class : cls == Short.TYPE ? Short.class : cls == Void.TYPE ? Void.class : cls;
}
private Primitives() {
}
public static boolean isPrimitive(Type type) {
return (type instanceof Class) && ((Class) type).isPrimitive();
}
}

View File

@@ -0,0 +1,105 @@
package com.google.gson.internal;
import com.google.gson.JsonElement;
import com.google.gson.JsonIOException;
import com.google.gson.JsonNull;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import com.google.gson.internal.bind.TypeAdapters;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.google.gson.stream.MalformedJsonException;
import java.io.EOFException;
import java.io.IOException;
import java.io.Writer;
/* loaded from: classes3.dex */
public final class Streams {
private Streams() {
throw new UnsupportedOperationException();
}
public static JsonElement parse(JsonReader jsonReader) throws JsonParseException {
boolean z;
try {
try {
jsonReader.peek();
z = false;
try {
return TypeAdapters.JSON_ELEMENT.read2(jsonReader);
} catch (EOFException e) {
e = e;
if (z) {
return JsonNull.INSTANCE;
}
throw new JsonSyntaxException(e);
}
} catch (EOFException e2) {
e = e2;
z = true;
}
} catch (MalformedJsonException e3) {
throw new JsonSyntaxException(e3);
} catch (IOException e4) {
throw new JsonIOException(e4);
} catch (NumberFormatException e5) {
throw new JsonSyntaxException(e5);
}
}
public static void write(JsonElement jsonElement, JsonWriter jsonWriter) throws IOException {
TypeAdapters.JSON_ELEMENT.write(jsonWriter, jsonElement);
}
public static Writer writerForAppendable(Appendable appendable) {
return appendable instanceof Writer ? (Writer) appendable : new AppendableWriter(appendable);
}
public static final class AppendableWriter extends Writer {
private final Appendable appendable;
private final CurrentWrite currentWrite = new CurrentWrite();
@Override // java.io.Writer, java.io.Closeable, java.lang.AutoCloseable
public void close() {
}
@Override // java.io.Writer, java.io.Flushable
public void flush() {
}
public AppendableWriter(Appendable appendable) {
this.appendable = appendable;
}
@Override // java.io.Writer
public void write(char[] cArr, int i, int i2) throws IOException {
CurrentWrite currentWrite = this.currentWrite;
currentWrite.chars = cArr;
this.appendable.append(currentWrite, i, i2 + i);
}
@Override // java.io.Writer
public void write(int i) throws IOException {
this.appendable.append((char) i);
}
public static class CurrentWrite implements CharSequence {
char[] chars;
@Override // java.lang.CharSequence
public int length() {
return this.chars.length;
}
@Override // java.lang.CharSequence
public char charAt(int i) {
return this.chars[i];
}
@Override // java.lang.CharSequence
public CharSequence subSequence(int i, int i2) {
return new String(this.chars, i, i2 - i);
}
}
}
}

View File

@@ -0,0 +1,73 @@
package com.google.gson.internal;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
/* loaded from: classes3.dex */
public abstract class UnsafeAllocator {
public abstract <T> T newInstance(Class<T> cls) throws Exception;
public static UnsafeAllocator create() {
try {
Class<?> cls = Class.forName("sun.misc.Unsafe");
Field declaredField = cls.getDeclaredField("theUnsafe");
declaredField.setAccessible(true);
final Object obj = declaredField.get(null);
final Method method = cls.getMethod("allocateInstance", Class.class);
return new UnsafeAllocator() { // from class: com.google.gson.internal.UnsafeAllocator.1
@Override // com.google.gson.internal.UnsafeAllocator
public <T> T newInstance(Class<T> cls2) throws Exception {
UnsafeAllocator.assertInstantiable(cls2);
return (T) method.invoke(obj, cls2);
}
};
} catch (Exception unused) {
try {
try {
Method declaredMethod = ObjectStreamClass.class.getDeclaredMethod("getConstructorId", Class.class);
declaredMethod.setAccessible(true);
final int intValue = ((Integer) declaredMethod.invoke(null, Object.class)).intValue();
final Method declaredMethod2 = ObjectStreamClass.class.getDeclaredMethod("newInstance", Class.class, Integer.TYPE);
declaredMethod2.setAccessible(true);
return new UnsafeAllocator() { // from class: com.google.gson.internal.UnsafeAllocator.2
@Override // com.google.gson.internal.UnsafeAllocator
public <T> T newInstance(Class<T> cls2) throws Exception {
UnsafeAllocator.assertInstantiable(cls2);
return (T) declaredMethod2.invoke(null, cls2, Integer.valueOf(intValue));
}
};
} catch (Exception unused2) {
final Method declaredMethod3 = ObjectInputStream.class.getDeclaredMethod("newInstance", Class.class, Class.class);
declaredMethod3.setAccessible(true);
return new UnsafeAllocator() { // from class: com.google.gson.internal.UnsafeAllocator.3
@Override // com.google.gson.internal.UnsafeAllocator
public <T> T newInstance(Class<T> cls2) throws Exception {
UnsafeAllocator.assertInstantiable(cls2);
return (T) declaredMethod3.invoke(null, cls2, Object.class);
}
};
}
} catch (Exception unused3) {
return new UnsafeAllocator() { // from class: com.google.gson.internal.UnsafeAllocator.4
@Override // com.google.gson.internal.UnsafeAllocator
public <T> T newInstance(Class<T> cls2) {
throw new UnsupportedOperationException("Cannot allocate " + cls2);
}
};
}
}
}
public static void assertInstantiable(Class<?> cls) {
int modifiers = cls.getModifiers();
if (Modifier.isInterface(modifiers)) {
throw new UnsupportedOperationException("Interface can't be instantiated! Interface name: " + cls.getName());
}
if (Modifier.isAbstract(modifiers)) {
throw new UnsupportedOperationException("Abstract class can't be instantiated! Class name: " + cls.getName());
}
}
}

View File

@@ -0,0 +1,72 @@
package com.google.gson.internal.bind;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.internal.C$Gson$Types;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Array;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.Type;
import java.util.ArrayList;
/* loaded from: classes3.dex */
public final class ArrayTypeAdapter<E> extends TypeAdapter<Object> {
public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { // from class: com.google.gson.internal.bind.ArrayTypeAdapter.1
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
Type type = typeToken.getType();
if (!(type instanceof GenericArrayType) && (!(type instanceof Class) || !((Class) type).isArray())) {
return null;
}
Type arrayComponentType = C$Gson$Types.getArrayComponentType(type);
return new ArrayTypeAdapter(gson, gson.getAdapter(TypeToken.get(arrayComponentType)), C$Gson$Types.getRawType(arrayComponentType));
}
};
private final Class<E> componentType;
private final TypeAdapter<E> componentTypeAdapter;
public ArrayTypeAdapter(Gson gson, TypeAdapter<E> typeAdapter, Class<E> cls) {
this.componentTypeAdapter = new TypeAdapterRuntimeTypeWrapper(gson, typeAdapter, cls);
this.componentType = cls;
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public Object read2(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
ArrayList arrayList = new ArrayList();
jsonReader.beginArray();
while (jsonReader.hasNext()) {
arrayList.add(this.componentTypeAdapter.read2(jsonReader));
}
jsonReader.endArray();
int size = arrayList.size();
Object newInstance = Array.newInstance((Class<?>) this.componentType, size);
for (int i = 0; i < size; i++) {
Array.set(newInstance, i, arrayList.get(i));
}
return newInstance;
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, Object obj) throws IOException {
if (obj == null) {
jsonWriter.nullValue();
return;
}
jsonWriter.beginArray();
int length = Array.getLength(obj);
for (int i = 0; i < length; i++) {
this.componentTypeAdapter.write(jsonWriter, Array.get(obj, i));
}
jsonWriter.endArray();
}
}

View File

@@ -0,0 +1,76 @@
package com.google.gson.internal.bind;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.internal.C$Gson$Types;
import com.google.gson.internal.ConstructorConstructor;
import com.google.gson.internal.ObjectConstructor;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.Iterator;
/* loaded from: classes3.dex */
public final class CollectionTypeAdapterFactory implements TypeAdapterFactory {
private final ConstructorConstructor constructorConstructor;
public CollectionTypeAdapterFactory(ConstructorConstructor constructorConstructor) {
this.constructorConstructor = constructorConstructor;
}
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
Type type = typeToken.getType();
Class<? super T> rawType = typeToken.getRawType();
if (!Collection.class.isAssignableFrom(rawType)) {
return null;
}
Type collectionElementType = C$Gson$Types.getCollectionElementType(type, rawType);
return new Adapter(gson, collectionElementType, gson.getAdapter(TypeToken.get(collectionElementType)), this.constructorConstructor.get(typeToken));
}
public static final class Adapter<E> extends TypeAdapter<Collection<E>> {
private final ObjectConstructor<? extends Collection<E>> constructor;
private final TypeAdapter<E> elementTypeAdapter;
public Adapter(Gson gson, Type type, TypeAdapter<E> typeAdapter, ObjectConstructor<? extends Collection<E>> objectConstructor) {
this.elementTypeAdapter = new TypeAdapterRuntimeTypeWrapper(gson, typeAdapter, type);
this.constructor = objectConstructor;
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public Collection<E> read2(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
Collection<E> construct = this.constructor.construct();
jsonReader.beginArray();
while (jsonReader.hasNext()) {
construct.add(this.elementTypeAdapter.read2(jsonReader));
}
jsonReader.endArray();
return construct;
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, Collection<E> collection) throws IOException {
if (collection == null) {
jsonWriter.nullValue();
return;
}
jsonWriter.beginArray();
Iterator<E> it = collection.iterator();
while (it.hasNext()) {
this.elementTypeAdapter.write(jsonWriter, it.next());
}
jsonWriter.endArray();
}
}
}

View File

@@ -0,0 +1,83 @@
package com.google.gson.internal.bind;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.internal.JavaVersion;
import com.google.gson.internal.PreJava9DateFormatProvider;
import com.google.gson.internal.bind.util.ISO8601Utils;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
/* loaded from: classes3.dex */
public final class DateTypeAdapter extends TypeAdapter<Date> {
public static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { // from class: com.google.gson.internal.bind.DateTypeAdapter.1
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
if (typeToken.getRawType() == Date.class) {
return new DateTypeAdapter();
}
return null;
}
};
private final List<DateFormat> dateFormats;
public DateTypeAdapter() {
ArrayList arrayList = new ArrayList();
this.dateFormats = arrayList;
Locale locale = Locale.US;
arrayList.add(DateFormat.getDateTimeInstance(2, 2, locale));
if (!Locale.getDefault().equals(locale)) {
arrayList.add(DateFormat.getDateTimeInstance(2, 2));
}
if (JavaVersion.isJava9OrLater()) {
arrayList.add(PreJava9DateFormatProvider.getUSDateTimeFormat(2, 2));
}
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read, reason: avoid collision after fix types in other method */
public Date read2(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
return deserializeToDate(jsonReader.nextString());
}
private synchronized Date deserializeToDate(String str) {
Iterator<DateFormat> it = this.dateFormats.iterator();
while (it.hasNext()) {
try {
return it.next().parse(str);
} catch (ParseException unused) {
}
}
try {
return ISO8601Utils.parse(str, new ParsePosition(0));
} catch (ParseException e) {
throw new JsonSyntaxException(str, e);
}
}
@Override // com.google.gson.TypeAdapter
public synchronized void write(JsonWriter jsonWriter, Date date) throws IOException {
if (date == null) {
jsonWriter.nullValue();
} else {
jsonWriter.value(this.dateFormats.get(0).format(date));
}
}
}

View File

@@ -0,0 +1,156 @@
package com.google.gson.internal.bind;
import com.google.gson.JsonSyntaxException;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.internal.C$Gson$Preconditions;
import com.google.gson.internal.JavaVersion;
import com.google.gson.internal.PreJava9DateFormatProvider;
import com.google.gson.internal.bind.util.ISO8601Utils;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
/* loaded from: classes3.dex */
public final class DefaultDateTypeAdapter<T extends Date> extends TypeAdapter<T> {
private static final String SIMPLE_NAME = "DefaultDateTypeAdapter";
private final List<DateFormat> dateFormats;
private final DateType<T> dateType;
public static abstract class DateType<T extends Date> {
public static final DateType<Date> DATE = new DateType<Date>(Date.class) { // from class: com.google.gson.internal.bind.DefaultDateTypeAdapter.DateType.1
@Override // com.google.gson.internal.bind.DefaultDateTypeAdapter.DateType
public Date deserialize(Date date) {
return date;
}
};
private final Class<T> dateClass;
public abstract T deserialize(Date date);
public DateType(Class<T> cls) {
this.dateClass = cls;
}
private final TypeAdapterFactory createFactory(DefaultDateTypeAdapter<T> defaultDateTypeAdapter) {
return TypeAdapters.newFactory(this.dateClass, defaultDateTypeAdapter);
}
public final TypeAdapterFactory createAdapterFactory(String str) {
return createFactory(new DefaultDateTypeAdapter<>(this, str));
}
public final TypeAdapterFactory createAdapterFactory(int i) {
return createFactory(new DefaultDateTypeAdapter<>(this, i));
}
public final TypeAdapterFactory createAdapterFactory(int i, int i2) {
return createFactory(new DefaultDateTypeAdapter<>(this, i, i2));
}
public final TypeAdapterFactory createDefaultsAdapterFactory() {
int i = 2;
return createFactory(new DefaultDateTypeAdapter<>(this, i, i));
}
}
private DefaultDateTypeAdapter(DateType<T> dateType, String str) {
ArrayList arrayList = new ArrayList();
this.dateFormats = arrayList;
this.dateType = (DateType) C$Gson$Preconditions.checkNotNull(dateType);
Locale locale = Locale.US;
arrayList.add(new SimpleDateFormat(str, locale));
if (Locale.getDefault().equals(locale)) {
return;
}
arrayList.add(new SimpleDateFormat(str));
}
private DefaultDateTypeAdapter(DateType<T> dateType, int i) {
ArrayList arrayList = new ArrayList();
this.dateFormats = arrayList;
this.dateType = (DateType) C$Gson$Preconditions.checkNotNull(dateType);
Locale locale = Locale.US;
arrayList.add(DateFormat.getDateInstance(i, locale));
if (!Locale.getDefault().equals(locale)) {
arrayList.add(DateFormat.getDateInstance(i));
}
if (JavaVersion.isJava9OrLater()) {
arrayList.add(PreJava9DateFormatProvider.getUSDateFormat(i));
}
}
private DefaultDateTypeAdapter(DateType<T> dateType, int i, int i2) {
ArrayList arrayList = new ArrayList();
this.dateFormats = arrayList;
this.dateType = (DateType) C$Gson$Preconditions.checkNotNull(dateType);
Locale locale = Locale.US;
arrayList.add(DateFormat.getDateTimeInstance(i, i2, locale));
if (!Locale.getDefault().equals(locale)) {
arrayList.add(DateFormat.getDateTimeInstance(i, i2));
}
if (JavaVersion.isJava9OrLater()) {
arrayList.add(PreJava9DateFormatProvider.getUSDateTimeFormat(i, i2));
}
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, Date date) throws IOException {
if (date == null) {
jsonWriter.nullValue();
return;
}
synchronized (this.dateFormats) {
jsonWriter.value(this.dateFormats.get(0).format(date));
}
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public T read2(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
return this.dateType.deserialize(deserializeToDate(jsonReader.nextString()));
}
private Date deserializeToDate(String str) {
synchronized (this.dateFormats) {
try {
Iterator<DateFormat> it = this.dateFormats.iterator();
while (it.hasNext()) {
try {
return it.next().parse(str);
} catch (ParseException unused) {
}
}
try {
return ISO8601Utils.parse(str, new ParsePosition(0));
} catch (ParseException e) {
throw new JsonSyntaxException(str, e);
}
} catch (Throwable th) {
throw th;
}
}
}
public String toString() {
DateFormat dateFormat = this.dateFormats.get(0);
if (dateFormat instanceof SimpleDateFormat) {
return "DefaultDateTypeAdapter(" + ((SimpleDateFormat) dateFormat).toPattern() + ')';
}
return "DefaultDateTypeAdapter(" + dateFormat.getClass().getSimpleName() + ')';
}
}

View File

@@ -0,0 +1,46 @@
package com.google.gson.internal.bind;
import com.google.gson.Gson;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonSerializer;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.internal.ConstructorConstructor;
import com.google.gson.reflect.TypeToken;
/* loaded from: classes3.dex */
public final class JsonAdapterAnnotationTypeAdapterFactory implements TypeAdapterFactory {
private final ConstructorConstructor constructorConstructor;
public JsonAdapterAnnotationTypeAdapterFactory(ConstructorConstructor constructorConstructor) {
this.constructorConstructor = constructorConstructor;
}
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
JsonAdapter jsonAdapter = (JsonAdapter) typeToken.getRawType().getAnnotation(JsonAdapter.class);
if (jsonAdapter == null) {
return null;
}
return (TypeAdapter<T>) getTypeAdapter(this.constructorConstructor, gson, typeToken, jsonAdapter);
}
public TypeAdapter<?> getTypeAdapter(ConstructorConstructor constructorConstructor, Gson gson, TypeToken<?> typeToken, JsonAdapter jsonAdapter) {
TypeAdapter<?> treeTypeAdapter;
Object construct = constructorConstructor.get(TypeToken.get((Class) jsonAdapter.value())).construct();
if (construct instanceof TypeAdapter) {
treeTypeAdapter = (TypeAdapter) construct;
} else if (construct instanceof TypeAdapterFactory) {
treeTypeAdapter = ((TypeAdapterFactory) construct).create(gson, typeToken);
} else {
boolean z = construct instanceof JsonSerializer;
if (z || (construct instanceof JsonDeserializer)) {
treeTypeAdapter = new TreeTypeAdapter<>(z ? (JsonSerializer) construct : null, construct instanceof JsonDeserializer ? (JsonDeserializer) construct : null, gson, typeToken, null);
} else {
throw new IllegalArgumentException("Invalid attempt to bind an instance of " + construct.getClass().getName() + " as a @JsonAdapter for " + typeToken.toString() + ". @JsonAdapter value must be a TypeAdapter, TypeAdapterFactory, JsonSerializer or JsonDeserializer.");
}
}
return (treeTypeAdapter == null || !jsonAdapter.nullSafe()) ? treeTypeAdapter : treeTypeAdapter.nullSafe();
}
}

View File

@@ -0,0 +1,361 @@
package com.google.gson.internal.bind;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import java.io.IOException;
import java.io.Reader;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
/* loaded from: classes3.dex */
public final class JsonTreeReader extends JsonReader {
private int[] pathIndices;
private String[] pathNames;
private Object[] stack;
private int stackSize;
private static final Reader UNREADABLE_READER = new Reader() { // from class: com.google.gson.internal.bind.JsonTreeReader.1
@Override // java.io.Reader
public int read(char[] cArr, int i, int i2) throws IOException {
throw new AssertionError();
}
@Override // java.io.Reader, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
throw new AssertionError();
}
};
private static final Object SENTINEL_CLOSED = new Object();
@Override // com.google.gson.stream.JsonReader, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
this.stack = new Object[]{SENTINEL_CLOSED};
this.stackSize = 1;
}
public JsonTreeReader(JsonElement jsonElement) {
super(UNREADABLE_READER);
this.stack = new Object[32];
this.stackSize = 0;
this.pathNames = new String[32];
this.pathIndices = new int[32];
push(jsonElement);
}
@Override // com.google.gson.stream.JsonReader
public void beginArray() throws IOException {
expect(JsonToken.BEGIN_ARRAY);
push(((JsonArray) peekStack()).iterator());
this.pathIndices[this.stackSize - 1] = 0;
}
@Override // com.google.gson.stream.JsonReader
public void endArray() throws IOException {
expect(JsonToken.END_ARRAY);
popStack();
popStack();
int i = this.stackSize;
if (i > 0) {
int[] iArr = this.pathIndices;
int i2 = i - 1;
iArr[i2] = iArr[i2] + 1;
}
}
@Override // com.google.gson.stream.JsonReader
public void beginObject() throws IOException {
expect(JsonToken.BEGIN_OBJECT);
push(((JsonObject) peekStack()).entrySet().iterator());
}
@Override // com.google.gson.stream.JsonReader
public void endObject() throws IOException {
expect(JsonToken.END_OBJECT);
popStack();
popStack();
int i = this.stackSize;
if (i > 0) {
int[] iArr = this.pathIndices;
int i2 = i - 1;
iArr[i2] = iArr[i2] + 1;
}
}
@Override // com.google.gson.stream.JsonReader
public boolean hasNext() throws IOException {
JsonToken peek = peek();
return (peek == JsonToken.END_OBJECT || peek == JsonToken.END_ARRAY) ? false : true;
}
@Override // com.google.gson.stream.JsonReader
public JsonToken peek() throws IOException {
if (this.stackSize == 0) {
return JsonToken.END_DOCUMENT;
}
Object peekStack = peekStack();
if (peekStack instanceof Iterator) {
boolean z = this.stack[this.stackSize - 2] instanceof JsonObject;
Iterator it = (Iterator) peekStack;
if (!it.hasNext()) {
return z ? JsonToken.END_OBJECT : JsonToken.END_ARRAY;
}
if (z) {
return JsonToken.NAME;
}
push(it.next());
return peek();
}
if (peekStack instanceof JsonObject) {
return JsonToken.BEGIN_OBJECT;
}
if (peekStack instanceof JsonArray) {
return JsonToken.BEGIN_ARRAY;
}
if (peekStack instanceof JsonPrimitive) {
JsonPrimitive jsonPrimitive = (JsonPrimitive) peekStack;
if (jsonPrimitive.isString()) {
return JsonToken.STRING;
}
if (jsonPrimitive.isBoolean()) {
return JsonToken.BOOLEAN;
}
if (jsonPrimitive.isNumber()) {
return JsonToken.NUMBER;
}
throw new AssertionError();
}
if (peekStack instanceof JsonNull) {
return JsonToken.NULL;
}
if (peekStack == SENTINEL_CLOSED) {
throw new IllegalStateException("JsonReader is closed");
}
throw new AssertionError();
}
private Object peekStack() {
return this.stack[this.stackSize - 1];
}
private Object popStack() {
Object[] objArr = this.stack;
int i = this.stackSize - 1;
this.stackSize = i;
Object obj = objArr[i];
objArr[i] = null;
return obj;
}
private void expect(JsonToken jsonToken) throws IOException {
if (peek() == jsonToken) {
return;
}
throw new IllegalStateException("Expected " + jsonToken + " but was " + peek() + locationString());
}
@Override // com.google.gson.stream.JsonReader
public String nextName() throws IOException {
expect(JsonToken.NAME);
Map.Entry entry = (Map.Entry) ((Iterator) peekStack()).next();
String str = (String) entry.getKey();
this.pathNames[this.stackSize - 1] = str;
push(entry.getValue());
return str;
}
@Override // com.google.gson.stream.JsonReader
public String nextString() throws IOException {
JsonToken peek = peek();
JsonToken jsonToken = JsonToken.STRING;
if (peek != jsonToken && peek != JsonToken.NUMBER) {
throw new IllegalStateException("Expected " + jsonToken + " but was " + peek + locationString());
}
String asString = ((JsonPrimitive) popStack()).getAsString();
int i = this.stackSize;
if (i > 0) {
int[] iArr = this.pathIndices;
int i2 = i - 1;
iArr[i2] = iArr[i2] + 1;
}
return asString;
}
@Override // com.google.gson.stream.JsonReader
public boolean nextBoolean() throws IOException {
expect(JsonToken.BOOLEAN);
boolean asBoolean = ((JsonPrimitive) popStack()).getAsBoolean();
int i = this.stackSize;
if (i > 0) {
int[] iArr = this.pathIndices;
int i2 = i - 1;
iArr[i2] = iArr[i2] + 1;
}
return asBoolean;
}
@Override // com.google.gson.stream.JsonReader
public void nextNull() throws IOException {
expect(JsonToken.NULL);
popStack();
int i = this.stackSize;
if (i > 0) {
int[] iArr = this.pathIndices;
int i2 = i - 1;
iArr[i2] = iArr[i2] + 1;
}
}
@Override // com.google.gson.stream.JsonReader
public double nextDouble() throws IOException {
JsonToken peek = peek();
JsonToken jsonToken = JsonToken.NUMBER;
if (peek != jsonToken && peek != JsonToken.STRING) {
throw new IllegalStateException("Expected " + jsonToken + " but was " + peek + locationString());
}
double asDouble = ((JsonPrimitive) peekStack()).getAsDouble();
if (!isLenient() && (Double.isNaN(asDouble) || Double.isInfinite(asDouble))) {
throw new NumberFormatException("JSON forbids NaN and infinities: " + asDouble);
}
popStack();
int i = this.stackSize;
if (i > 0) {
int[] iArr = this.pathIndices;
int i2 = i - 1;
iArr[i2] = iArr[i2] + 1;
}
return asDouble;
}
@Override // com.google.gson.stream.JsonReader
public long nextLong() throws IOException {
JsonToken peek = peek();
JsonToken jsonToken = JsonToken.NUMBER;
if (peek != jsonToken && peek != JsonToken.STRING) {
throw new IllegalStateException("Expected " + jsonToken + " but was " + peek + locationString());
}
long asLong = ((JsonPrimitive) peekStack()).getAsLong();
popStack();
int i = this.stackSize;
if (i > 0) {
int[] iArr = this.pathIndices;
int i2 = i - 1;
iArr[i2] = iArr[i2] + 1;
}
return asLong;
}
@Override // com.google.gson.stream.JsonReader
public int nextInt() throws IOException {
JsonToken peek = peek();
JsonToken jsonToken = JsonToken.NUMBER;
if (peek != jsonToken && peek != JsonToken.STRING) {
throw new IllegalStateException("Expected " + jsonToken + " but was " + peek + locationString());
}
int asInt = ((JsonPrimitive) peekStack()).getAsInt();
popStack();
int i = this.stackSize;
if (i > 0) {
int[] iArr = this.pathIndices;
int i2 = i - 1;
iArr[i2] = iArr[i2] + 1;
}
return asInt;
}
public JsonElement nextJsonElement() throws IOException {
JsonToken peek = peek();
if (peek == JsonToken.NAME || peek == JsonToken.END_ARRAY || peek == JsonToken.END_OBJECT || peek == JsonToken.END_DOCUMENT) {
throw new IllegalStateException("Unexpected " + peek + " when reading a JsonElement.");
}
JsonElement jsonElement = (JsonElement) peekStack();
skipValue();
return jsonElement;
}
@Override // com.google.gson.stream.JsonReader
public void skipValue() throws IOException {
if (peek() == JsonToken.NAME) {
nextName();
this.pathNames[this.stackSize - 2] = "null";
} else {
popStack();
int i = this.stackSize;
if (i > 0) {
this.pathNames[i - 1] = "null";
}
}
int i2 = this.stackSize;
if (i2 > 0) {
int[] iArr = this.pathIndices;
int i3 = i2 - 1;
iArr[i3] = iArr[i3] + 1;
}
}
@Override // com.google.gson.stream.JsonReader
public String toString() {
return JsonTreeReader.class.getSimpleName() + locationString();
}
public void promoteNameToValue() throws IOException {
expect(JsonToken.NAME);
Map.Entry entry = (Map.Entry) ((Iterator) peekStack()).next();
push(entry.getValue());
push(new JsonPrimitive((String) entry.getKey()));
}
private void push(Object obj) {
int i = this.stackSize;
Object[] objArr = this.stack;
if (i == objArr.length) {
int i2 = i * 2;
this.stack = Arrays.copyOf(objArr, i2);
this.pathIndices = Arrays.copyOf(this.pathIndices, i2);
this.pathNames = (String[]) Arrays.copyOf(this.pathNames, i2);
}
Object[] objArr2 = this.stack;
int i3 = this.stackSize;
this.stackSize = i3 + 1;
objArr2[i3] = obj;
}
@Override // com.google.gson.stream.JsonReader
public String getPath() {
StringBuilder sb = new StringBuilder();
sb.append('$');
int i = 0;
while (true) {
int i2 = this.stackSize;
if (i < i2) {
Object[] objArr = this.stack;
Object obj = objArr[i];
if (obj instanceof JsonArray) {
i++;
if (i < i2 && (objArr[i] instanceof Iterator)) {
sb.append('[');
sb.append(this.pathIndices[i]);
sb.append(']');
}
} else if ((obj instanceof JsonObject) && (i = i + 1) < i2 && (objArr[i] instanceof Iterator)) {
sb.append('.');
String str = this.pathNames[i];
if (str != null) {
sb.append(str);
}
}
i++;
} else {
return sb.toString();
}
}
}
private String locationString() {
return " at path " + getPath();
}
}

View File

@@ -0,0 +1,201 @@
package com.google.gson.internal.bind;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.google.gson.stream.JsonWriter;
import csdk.gluads.Consts;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes3.dex */
public final class JsonTreeWriter extends JsonWriter {
private String pendingName;
private JsonElement product;
private final List<JsonElement> stack;
private static final Writer UNWRITABLE_WRITER = new Writer() { // from class: com.google.gson.internal.bind.JsonTreeWriter.1
@Override // java.io.Writer
public void write(char[] cArr, int i, int i2) {
throw new AssertionError();
}
@Override // java.io.Writer, java.io.Flushable
public void flush() throws IOException {
throw new AssertionError();
}
@Override // java.io.Writer, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
throw new AssertionError();
}
};
private static final JsonPrimitive SENTINEL_CLOSED = new JsonPrimitive(Consts.PLACEMENT_STATUS_CLOSED);
@Override // com.google.gson.stream.JsonWriter, java.io.Flushable
public void flush() throws IOException {
}
public JsonTreeWriter() {
super(UNWRITABLE_WRITER);
this.stack = new ArrayList();
this.product = JsonNull.INSTANCE;
}
public JsonElement get() {
if (this.stack.isEmpty()) {
return this.product;
}
throw new IllegalStateException("Expected one JSON element but was " + this.stack);
}
private JsonElement peek() {
return this.stack.get(r0.size() - 1);
}
private void put(JsonElement jsonElement) {
if (this.pendingName != null) {
if (!jsonElement.isJsonNull() || getSerializeNulls()) {
((JsonObject) peek()).add(this.pendingName, jsonElement);
}
this.pendingName = null;
return;
}
if (this.stack.isEmpty()) {
this.product = jsonElement;
return;
}
JsonElement peek = peek();
if (peek instanceof JsonArray) {
((JsonArray) peek).add(jsonElement);
return;
}
throw new IllegalStateException();
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter beginArray() throws IOException {
JsonArray jsonArray = new JsonArray();
put(jsonArray);
this.stack.add(jsonArray);
return this;
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter endArray() throws IOException {
if (this.stack.isEmpty() || this.pendingName != null) {
throw new IllegalStateException();
}
if (peek() instanceof JsonArray) {
this.stack.remove(r0.size() - 1);
return this;
}
throw new IllegalStateException();
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter beginObject() throws IOException {
JsonObject jsonObject = new JsonObject();
put(jsonObject);
this.stack.add(jsonObject);
return this;
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter endObject() throws IOException {
if (this.stack.isEmpty() || this.pendingName != null) {
throw new IllegalStateException();
}
if (peek() instanceof JsonObject) {
this.stack.remove(r0.size() - 1);
return this;
}
throw new IllegalStateException();
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter name(String str) throws IOException {
if (str == null) {
throw new NullPointerException("name == null");
}
if (this.stack.isEmpty() || this.pendingName != null) {
throw new IllegalStateException();
}
if (!(peek() instanceof JsonObject)) {
throw new IllegalStateException();
}
this.pendingName = str;
return this;
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter value(String str) throws IOException {
if (str == null) {
return nullValue();
}
put(new JsonPrimitive(str));
return this;
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter nullValue() throws IOException {
put(JsonNull.INSTANCE);
return this;
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter value(boolean z) throws IOException {
put(new JsonPrimitive(Boolean.valueOf(z)));
return this;
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter value(Boolean bool) throws IOException {
if (bool == null) {
return nullValue();
}
put(new JsonPrimitive(bool));
return this;
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter value(double d) throws IOException {
if (!isLenient() && (Double.isNaN(d) || Double.isInfinite(d))) {
throw new IllegalArgumentException("JSON forbids NaN and infinities: " + d);
}
put(new JsonPrimitive(Double.valueOf(d)));
return this;
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter value(long j) throws IOException {
put(new JsonPrimitive(Long.valueOf(j)));
return this;
}
@Override // com.google.gson.stream.JsonWriter
public JsonWriter value(Number number) throws IOException {
if (number == null) {
return nullValue();
}
if (!isLenient()) {
double doubleValue = number.doubleValue();
if (Double.isNaN(doubleValue) || Double.isInfinite(doubleValue)) {
throw new IllegalArgumentException("JSON forbids NaN and infinities: " + number);
}
}
put(new JsonPrimitive(number));
return this;
}
@Override // com.google.gson.stream.JsonWriter, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
if (!this.stack.isEmpty()) {
throw new IOException("Incomplete document");
}
this.stack.add(SENTINEL_CLOSED);
}
}

View File

@@ -0,0 +1,163 @@
package com.google.gson.internal.bind;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSyntaxException;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.internal.C$Gson$Types;
import com.google.gson.internal.ConstructorConstructor;
import com.google.gson.internal.JsonReaderInternalAccess;
import com.google.gson.internal.ObjectConstructor;
import com.google.gson.internal.Streams;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Map;
/* loaded from: classes3.dex */
public final class MapTypeAdapterFactory implements TypeAdapterFactory {
final boolean complexMapKeySerialization;
private final ConstructorConstructor constructorConstructor;
public MapTypeAdapterFactory(ConstructorConstructor constructorConstructor, boolean z) {
this.constructorConstructor = constructorConstructor;
this.complexMapKeySerialization = z;
}
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
Type type = typeToken.getType();
if (!Map.class.isAssignableFrom(typeToken.getRawType())) {
return null;
}
Type[] mapKeyAndValueTypes = C$Gson$Types.getMapKeyAndValueTypes(type, C$Gson$Types.getRawType(type));
return new Adapter(gson, mapKeyAndValueTypes[0], getKeyAdapter(gson, mapKeyAndValueTypes[0]), mapKeyAndValueTypes[1], gson.getAdapter(TypeToken.get(mapKeyAndValueTypes[1])), this.constructorConstructor.get(typeToken));
}
private TypeAdapter<?> getKeyAdapter(Gson gson, Type type) {
if (type == Boolean.TYPE || type == Boolean.class) {
return TypeAdapters.BOOLEAN_AS_STRING;
}
return gson.getAdapter(TypeToken.get(type));
}
public final class Adapter<K, V> extends TypeAdapter<Map<K, V>> {
private final ObjectConstructor<? extends Map<K, V>> constructor;
private final TypeAdapter<K> keyTypeAdapter;
private final TypeAdapter<V> valueTypeAdapter;
public Adapter(Gson gson, Type type, TypeAdapter<K> typeAdapter, Type type2, TypeAdapter<V> typeAdapter2, ObjectConstructor<? extends Map<K, V>> objectConstructor) {
this.keyTypeAdapter = new TypeAdapterRuntimeTypeWrapper(gson, typeAdapter, type);
this.valueTypeAdapter = new TypeAdapterRuntimeTypeWrapper(gson, typeAdapter2, type2);
this.constructor = objectConstructor;
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public Map<K, V> read2(JsonReader jsonReader) throws IOException {
JsonToken peek = jsonReader.peek();
if (peek == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
Map<K, V> construct = this.constructor.construct();
if (peek == JsonToken.BEGIN_ARRAY) {
jsonReader.beginArray();
while (jsonReader.hasNext()) {
jsonReader.beginArray();
K read2 = this.keyTypeAdapter.read2(jsonReader);
if (construct.put(read2, this.valueTypeAdapter.read2(jsonReader)) != null) {
throw new JsonSyntaxException("duplicate key: " + read2);
}
jsonReader.endArray();
}
jsonReader.endArray();
} else {
jsonReader.beginObject();
while (jsonReader.hasNext()) {
JsonReaderInternalAccess.INSTANCE.promoteNameToValue(jsonReader);
K read22 = this.keyTypeAdapter.read2(jsonReader);
if (construct.put(read22, this.valueTypeAdapter.read2(jsonReader)) != null) {
throw new JsonSyntaxException("duplicate key: " + read22);
}
}
jsonReader.endObject();
}
return construct;
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, Map<K, V> map) throws IOException {
if (map == null) {
jsonWriter.nullValue();
return;
}
if (!MapTypeAdapterFactory.this.complexMapKeySerialization) {
jsonWriter.beginObject();
for (Map.Entry<K, V> entry : map.entrySet()) {
jsonWriter.name(String.valueOf(entry.getKey()));
this.valueTypeAdapter.write(jsonWriter, entry.getValue());
}
jsonWriter.endObject();
return;
}
ArrayList arrayList = new ArrayList(map.size());
ArrayList arrayList2 = new ArrayList(map.size());
int i = 0;
boolean z = false;
for (Map.Entry<K, V> entry2 : map.entrySet()) {
JsonElement jsonTree = this.keyTypeAdapter.toJsonTree(entry2.getKey());
arrayList.add(jsonTree);
arrayList2.add(entry2.getValue());
z |= jsonTree.isJsonArray() || jsonTree.isJsonObject();
}
if (z) {
jsonWriter.beginArray();
int size = arrayList.size();
while (i < size) {
jsonWriter.beginArray();
Streams.write((JsonElement) arrayList.get(i), jsonWriter);
this.valueTypeAdapter.write(jsonWriter, arrayList2.get(i));
jsonWriter.endArray();
i++;
}
jsonWriter.endArray();
return;
}
jsonWriter.beginObject();
int size2 = arrayList.size();
while (i < size2) {
jsonWriter.name(keyToString((JsonElement) arrayList.get(i)));
this.valueTypeAdapter.write(jsonWriter, arrayList2.get(i));
i++;
}
jsonWriter.endObject();
}
private String keyToString(JsonElement jsonElement) {
if (jsonElement.isJsonPrimitive()) {
JsonPrimitive asJsonPrimitive = jsonElement.getAsJsonPrimitive();
if (asJsonPrimitive.isNumber()) {
return String.valueOf(asJsonPrimitive.getAsNumber());
}
if (asJsonPrimitive.isBoolean()) {
return Boolean.toString(asJsonPrimitive.getAsBoolean());
}
if (asJsonPrimitive.isString()) {
return asJsonPrimitive.getAsString();
}
throw new AssertionError();
}
if (jsonElement.isJsonNull()) {
return "null";
}
throw new AssertionError();
}
}
}

View File

@@ -0,0 +1,82 @@
package com.google.gson.internal.bind;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.ToNumberPolicy;
import com.google.gson.ToNumberStrategy;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
/* loaded from: classes3.dex */
public final class NumberTypeAdapter extends TypeAdapter<Number> {
private static final TypeAdapterFactory LAZILY_PARSED_NUMBER_FACTORY = newFactory(ToNumberPolicy.LAZILY_PARSED_NUMBER);
private final ToNumberStrategy toNumberStrategy;
private NumberTypeAdapter(ToNumberStrategy toNumberStrategy) {
this.toNumberStrategy = toNumberStrategy;
}
private static TypeAdapterFactory newFactory(ToNumberStrategy toNumberStrategy) {
return new TypeAdapterFactory() { // from class: com.google.gson.internal.bind.NumberTypeAdapter.1
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
if (typeToken.getRawType() == Number.class) {
return NumberTypeAdapter.this;
}
return null;
}
};
}
public static TypeAdapterFactory getFactory(ToNumberStrategy toNumberStrategy) {
return toNumberStrategy == ToNumberPolicy.LAZILY_PARSED_NUMBER ? LAZILY_PARSED_NUMBER_FACTORY : newFactory(toNumberStrategy);
}
/* renamed from: com.google.gson.internal.bind.NumberTypeAdapter$2, reason: invalid class name */
public static /* synthetic */ class AnonymousClass2 {
static final /* synthetic */ int[] $SwitchMap$com$google$gson$stream$JsonToken;
static {
int[] iArr = new int[JsonToken.values().length];
$SwitchMap$com$google$gson$stream$JsonToken = iArr;
try {
iArr[JsonToken.NULL.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.NUMBER.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.STRING.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
}
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public Number read2(JsonReader jsonReader) throws IOException {
JsonToken peek = jsonReader.peek();
int i = AnonymousClass2.$SwitchMap$com$google$gson$stream$JsonToken[peek.ordinal()];
if (i == 1) {
jsonReader.nextNull();
return null;
}
if (i == 2 || i == 3) {
return this.toNumberStrategy.readNumber(jsonReader);
}
throw new JsonSyntaxException("Expecting number, got: " + peek);
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, Number number) throws IOException {
jsonWriter.value(number);
}
}

View File

@@ -0,0 +1,125 @@
package com.google.gson.internal.bind;
import com.google.gson.Gson;
import com.google.gson.ToNumberPolicy;
import com.google.gson.ToNumberStrategy;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.internal.LinkedTreeMap;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.util.ArrayList;
/* loaded from: classes3.dex */
public final class ObjectTypeAdapter extends TypeAdapter<Object> {
private static final TypeAdapterFactory DOUBLE_FACTORY = newFactory(ToNumberPolicy.DOUBLE);
private final Gson gson;
private final ToNumberStrategy toNumberStrategy;
private ObjectTypeAdapter(Gson gson, ToNumberStrategy toNumberStrategy) {
this.gson = gson;
this.toNumberStrategy = toNumberStrategy;
}
private static TypeAdapterFactory newFactory(final ToNumberStrategy toNumberStrategy) {
return new TypeAdapterFactory() { // from class: com.google.gson.internal.bind.ObjectTypeAdapter.1
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
if (typeToken.getRawType() == Object.class) {
return new ObjectTypeAdapter(gson, ToNumberStrategy.this);
}
return null;
}
};
}
public static TypeAdapterFactory getFactory(ToNumberStrategy toNumberStrategy) {
return toNumberStrategy == ToNumberPolicy.DOUBLE ? DOUBLE_FACTORY : newFactory(toNumberStrategy);
}
/* renamed from: com.google.gson.internal.bind.ObjectTypeAdapter$2, reason: invalid class name */
public static /* synthetic */ class AnonymousClass2 {
static final /* synthetic */ int[] $SwitchMap$com$google$gson$stream$JsonToken;
static {
int[] iArr = new int[JsonToken.values().length];
$SwitchMap$com$google$gson$stream$JsonToken = iArr;
try {
iArr[JsonToken.BEGIN_ARRAY.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.BEGIN_OBJECT.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.STRING.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.NUMBER.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.BOOLEAN.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$google$gson$stream$JsonToken[JsonToken.NULL.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
}
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public Object read2(JsonReader jsonReader) throws IOException {
switch (AnonymousClass2.$SwitchMap$com$google$gson$stream$JsonToken[jsonReader.peek().ordinal()]) {
case 1:
ArrayList arrayList = new ArrayList();
jsonReader.beginArray();
while (jsonReader.hasNext()) {
arrayList.add(read2(jsonReader));
}
jsonReader.endArray();
return arrayList;
case 2:
LinkedTreeMap linkedTreeMap = new LinkedTreeMap();
jsonReader.beginObject();
while (jsonReader.hasNext()) {
linkedTreeMap.put(jsonReader.nextName(), read2(jsonReader));
}
jsonReader.endObject();
return linkedTreeMap;
case 3:
return jsonReader.nextString();
case 4:
return this.toNumberStrategy.readNumber(jsonReader);
case 5:
return Boolean.valueOf(jsonReader.nextBoolean());
case 6:
jsonReader.nextNull();
return null;
default:
throw new IllegalStateException();
}
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, Object obj) throws IOException {
if (obj == null) {
jsonWriter.nullValue();
return;
}
TypeAdapter adapter = this.gson.getAdapter(obj.getClass());
if (adapter instanceof ObjectTypeAdapter) {
jsonWriter.beginObject();
jsonWriter.endObject();
} else {
adapter.write(jsonWriter, obj);
}
}
}

View File

@@ -0,0 +1,241 @@
package com.google.gson.internal.bind;
import com.google.gson.FieldNamingStrategy;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.internal.C$Gson$Types;
import com.google.gson.internal.ConstructorConstructor;
import com.google.gson.internal.Excluder;
import com.google.gson.internal.ObjectConstructor;
import com.google.gson.internal.Primitives;
import com.google.gson.internal.reflect.ReflectionAccessor;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes3.dex */
public final class ReflectiveTypeAdapterFactory implements TypeAdapterFactory {
private final ReflectionAccessor accessor = ReflectionAccessor.getInstance();
private final ConstructorConstructor constructorConstructor;
private final Excluder excluder;
private final FieldNamingStrategy fieldNamingPolicy;
private final JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory;
public ReflectiveTypeAdapterFactory(ConstructorConstructor constructorConstructor, FieldNamingStrategy fieldNamingStrategy, Excluder excluder, JsonAdapterAnnotationTypeAdapterFactory jsonAdapterAnnotationTypeAdapterFactory) {
this.constructorConstructor = constructorConstructor;
this.fieldNamingPolicy = fieldNamingStrategy;
this.excluder = excluder;
this.jsonAdapterFactory = jsonAdapterAnnotationTypeAdapterFactory;
}
public boolean excludeField(Field field, boolean z) {
return excludeField(field, z, this.excluder);
}
public static boolean excludeField(Field field, boolean z, Excluder excluder) {
return (excluder.excludeClass(field.getType(), z) || excluder.excludeField(field, z)) ? false : true;
}
private List<String> getFieldNames(Field field) {
SerializedName serializedName = (SerializedName) field.getAnnotation(SerializedName.class);
if (serializedName == null) {
return Collections.singletonList(this.fieldNamingPolicy.translateName(field));
}
String value = serializedName.value();
String[] alternate = serializedName.alternate();
if (alternate.length == 0) {
return Collections.singletonList(value);
}
ArrayList arrayList = new ArrayList(alternate.length + 1);
arrayList.add(value);
for (String str : alternate) {
arrayList.add(str);
}
return arrayList;
}
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
Class<? super T> rawType = typeToken.getRawType();
if (Object.class.isAssignableFrom(rawType)) {
return new Adapter(this.constructorConstructor.get(typeToken), getBoundFields(gson, typeToken, rawType));
}
return null;
}
private BoundField createBoundField(final Gson gson, final Field field, String str, final TypeToken<?> typeToken, boolean z, boolean z2) {
final boolean isPrimitive = Primitives.isPrimitive(typeToken.getRawType());
JsonAdapter jsonAdapter = (JsonAdapter) field.getAnnotation(JsonAdapter.class);
TypeAdapter<?> typeAdapter = jsonAdapter != null ? this.jsonAdapterFactory.getTypeAdapter(this.constructorConstructor, gson, typeToken, jsonAdapter) : null;
final boolean z3 = typeAdapter != null;
if (typeAdapter == null) {
typeAdapter = gson.getAdapter(typeToken);
}
final TypeAdapter<?> typeAdapter2 = typeAdapter;
return new BoundField(str, z, z2) { // from class: com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.1
@Override // com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.BoundField
public void write(JsonWriter jsonWriter, Object obj) throws IOException, IllegalAccessException {
(z3 ? typeAdapter2 : new TypeAdapterRuntimeTypeWrapper(gson, typeAdapter2, typeToken.getType())).write(jsonWriter, field.get(obj));
}
@Override // com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.BoundField
public void read(JsonReader jsonReader, Object obj) throws IOException, IllegalAccessException {
Object read2 = typeAdapter2.read2(jsonReader);
if (read2 == null && isPrimitive) {
return;
}
field.set(obj, read2);
}
@Override // com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.BoundField
public boolean writeField(Object obj) throws IOException, IllegalAccessException {
return this.serialized && field.get(obj) != obj;
}
};
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r2v1 */
/* JADX WARN: Type inference failed for: r2v2, types: [int] */
/* JADX WARN: Type inference failed for: r2v7 */
private Map<String, BoundField> getBoundFields(Gson gson, TypeToken<?> typeToken, Class<?> cls) {
LinkedHashMap linkedHashMap = new LinkedHashMap();
if (cls.isInterface()) {
return linkedHashMap;
}
Type type = typeToken.getType();
TypeToken<?> typeToken2 = typeToken;
Class<?> cls2 = cls;
while (cls2 != Object.class) {
Field[] declaredFields = cls2.getDeclaredFields();
int length = declaredFields.length;
boolean z = false;
int i = 0;
while (i < length) {
Field field = declaredFields[i];
boolean excludeField = excludeField(field, true);
boolean excludeField2 = excludeField(field, z);
if (excludeField || excludeField2) {
this.accessor.makeAccessible(field);
Type resolve = C$Gson$Types.resolve(typeToken2.getType(), cls2, field.getGenericType());
List<String> fieldNames = getFieldNames(field);
int size = fieldNames.size();
BoundField boundField = null;
?? r2 = z;
while (r2 < size) {
String str = fieldNames.get(r2);
boolean z2 = r2 != 0 ? z : excludeField;
int i2 = r2;
BoundField boundField2 = boundField;
int i3 = size;
List<String> list = fieldNames;
Field field2 = field;
boundField = boundField2 == null ? (BoundField) linkedHashMap.put(str, createBoundField(gson, field, str, TypeToken.get(resolve), z2, excludeField2)) : boundField2;
excludeField = z2;
fieldNames = list;
size = i3;
field = field2;
z = false;
r2 = i2 + 1;
}
BoundField boundField3 = boundField;
if (boundField3 != null) {
throw new IllegalArgumentException(type + " declares multiple JSON fields named " + boundField3.name);
}
}
i++;
z = false;
}
typeToken2 = TypeToken.get(C$Gson$Types.resolve(typeToken2.getType(), cls2, cls2.getGenericSuperclass()));
cls2 = typeToken2.getRawType();
}
return linkedHashMap;
}
public static abstract class BoundField {
final boolean deserialized;
final String name;
final boolean serialized;
public abstract void read(JsonReader jsonReader, Object obj) throws IOException, IllegalAccessException;
public abstract void write(JsonWriter jsonWriter, Object obj) throws IOException, IllegalAccessException;
public abstract boolean writeField(Object obj) throws IOException, IllegalAccessException;
public BoundField(String str, boolean z, boolean z2) {
this.name = str;
this.serialized = z;
this.deserialized = z2;
}
}
public static final class Adapter<T> extends TypeAdapter<T> {
private final Map<String, BoundField> boundFields;
private final ObjectConstructor<T> constructor;
public Adapter(ObjectConstructor<T> objectConstructor, Map<String, BoundField> map) {
this.constructor = objectConstructor;
this.boundFields = map;
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public T read2(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
T construct = this.constructor.construct();
try {
jsonReader.beginObject();
while (jsonReader.hasNext()) {
BoundField boundField = this.boundFields.get(jsonReader.nextName());
if (boundField != null && boundField.deserialized) {
boundField.read(jsonReader, construct);
}
jsonReader.skipValue();
}
jsonReader.endObject();
return construct;
} catch (IllegalAccessException e) {
throw new AssertionError(e);
} catch (IllegalStateException e2) {
throw new JsonSyntaxException(e2);
}
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, T t) throws IOException {
if (t == null) {
jsonWriter.nullValue();
return;
}
jsonWriter.beginObject();
try {
for (BoundField boundField : this.boundFields.values()) {
if (boundField.writeField(t)) {
jsonWriter.name(boundField.name);
boundField.write(jsonWriter, t);
}
}
jsonWriter.endObject();
} catch (IllegalAccessException e) {
throw new AssertionError(e);
}
}
}
}

View File

@@ -0,0 +1,132 @@
package com.google.gson.internal.bind;
import com.google.gson.Gson;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.internal.C$Gson$Preconditions;
import com.google.gson.internal.Streams;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Type;
/* loaded from: classes3.dex */
public final class TreeTypeAdapter<T> extends TypeAdapter<T> {
private final TreeTypeAdapter<T>.GsonContextImpl context = new GsonContextImpl();
private TypeAdapter<T> delegate;
private final JsonDeserializer<T> deserializer;
final Gson gson;
private final JsonSerializer<T> serializer;
private final TypeAdapterFactory skipPast;
private final TypeToken<T> typeToken;
public TreeTypeAdapter(JsonSerializer<T> jsonSerializer, JsonDeserializer<T> jsonDeserializer, Gson gson, TypeToken<T> typeToken, TypeAdapterFactory typeAdapterFactory) {
this.serializer = jsonSerializer;
this.deserializer = jsonDeserializer;
this.gson = gson;
this.typeToken = typeToken;
this.skipPast = typeAdapterFactory;
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public T read2(JsonReader jsonReader) throws IOException {
if (this.deserializer == null) {
return delegate().read2(jsonReader);
}
JsonElement parse = Streams.parse(jsonReader);
if (parse.isJsonNull()) {
return null;
}
return this.deserializer.deserialize(parse, this.typeToken.getType(), this.context);
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, T t) throws IOException {
JsonSerializer<T> jsonSerializer = this.serializer;
if (jsonSerializer == null) {
delegate().write(jsonWriter, t);
} else if (t == null) {
jsonWriter.nullValue();
} else {
Streams.write(jsonSerializer.serialize(t, this.typeToken.getType(), this.context), jsonWriter);
}
}
private TypeAdapter<T> delegate() {
TypeAdapter<T> typeAdapter = this.delegate;
if (typeAdapter != null) {
return typeAdapter;
}
TypeAdapter<T> delegateAdapter = this.gson.getDelegateAdapter(this.skipPast, this.typeToken);
this.delegate = delegateAdapter;
return delegateAdapter;
}
public static TypeAdapterFactory newFactory(TypeToken<?> typeToken, Object obj) {
return new SingleTypeFactory(obj, typeToken, false, null);
}
public static TypeAdapterFactory newFactoryWithMatchRawType(TypeToken<?> typeToken, Object obj) {
return new SingleTypeFactory(obj, typeToken, typeToken.getType() == typeToken.getRawType(), null);
}
public static TypeAdapterFactory newTypeHierarchyFactory(Class<?> cls, Object obj) {
return new SingleTypeFactory(obj, null, false, cls);
}
public static final class SingleTypeFactory implements TypeAdapterFactory {
private final JsonDeserializer<?> deserializer;
private final TypeToken<?> exactType;
private final Class<?> hierarchyType;
private final boolean matchRawType;
private final JsonSerializer<?> serializer;
public SingleTypeFactory(Object obj, TypeToken<?> typeToken, boolean z, Class<?> cls) {
JsonSerializer<?> jsonSerializer = obj instanceof JsonSerializer ? (JsonSerializer) obj : null;
this.serializer = jsonSerializer;
JsonDeserializer<?> jsonDeserializer = obj instanceof JsonDeserializer ? (JsonDeserializer) obj : null;
this.deserializer = jsonDeserializer;
C$Gson$Preconditions.checkArgument((jsonSerializer == null && jsonDeserializer == null) ? false : true);
this.exactType = typeToken;
this.matchRawType = z;
this.hierarchyType = cls;
}
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
TypeToken<?> typeToken2 = this.exactType;
if (typeToken2 == null ? !this.hierarchyType.isAssignableFrom(typeToken.getRawType()) : !(typeToken2.equals(typeToken) || (this.matchRawType && this.exactType.getType() == typeToken.getRawType()))) {
return null;
}
return new TreeTypeAdapter(this.serializer, this.deserializer, gson, typeToken, this);
}
}
public final class GsonContextImpl implements JsonSerializationContext, JsonDeserializationContext {
private GsonContextImpl() {
}
@Override // com.google.gson.JsonSerializationContext
public JsonElement serialize(Object obj) {
return TreeTypeAdapter.this.gson.toJsonTree(obj);
}
@Override // com.google.gson.JsonSerializationContext
public JsonElement serialize(Object obj, Type type) {
return TreeTypeAdapter.this.gson.toJsonTree(obj, type);
}
@Override // com.google.gson.JsonDeserializationContext
public <R> R deserialize(JsonElement jsonElement, Type type) throws JsonParseException {
return (R) TreeTypeAdapter.this.gson.fromJson(jsonElement, type);
}
}
}

View File

@@ -0,0 +1,50 @@
package com.google.gson.internal.bind;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.internal.bind.ReflectiveTypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
/* loaded from: classes3.dex */
final class TypeAdapterRuntimeTypeWrapper<T> extends TypeAdapter<T> {
private final Gson context;
private final TypeAdapter<T> delegate;
private final Type type;
public TypeAdapterRuntimeTypeWrapper(Gson gson, TypeAdapter<T> typeAdapter, Type type) {
this.context = gson;
this.delegate = typeAdapter;
this.type = type;
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public T read2(JsonReader jsonReader) throws IOException {
return this.delegate.read2(jsonReader);
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, T t) throws IOException {
TypeAdapter<T> typeAdapter = this.delegate;
Type runtimeTypeIfMoreSpecific = getRuntimeTypeIfMoreSpecific(this.type, t);
if (runtimeTypeIfMoreSpecific != this.type) {
typeAdapter = this.context.getAdapter(TypeToken.get(runtimeTypeIfMoreSpecific));
if (typeAdapter instanceof ReflectiveTypeAdapterFactory.Adapter) {
TypeAdapter<T> typeAdapter2 = this.delegate;
if (!(typeAdapter2 instanceof ReflectiveTypeAdapterFactory.Adapter)) {
typeAdapter = typeAdapter2;
}
}
}
typeAdapter.write(jsonWriter, t);
}
private Type getRuntimeTypeIfMoreSpecific(Type type, Object obj) {
return obj != null ? (type == Object.class || (type instanceof TypeVariable) || (type instanceof Class)) ? obj.getClass() : type : type;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,122 @@
package com.google.gson.internal.bind.util;
import com.mbridge.msdk.newreward.function.common.MBridgeCommon;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
/* loaded from: classes3.dex */
public class ISO8601Utils {
private static final String UTC_ID = "UTC";
private static final TimeZone TIMEZONE_UTC = TimeZone.getTimeZone(UTC_ID);
public static String format(Date date) {
return format(date, false, TIMEZONE_UTC);
}
public static String format(Date date, boolean z) {
return format(date, z, TIMEZONE_UTC);
}
public static String format(Date date, boolean z, TimeZone timeZone) {
GregorianCalendar gregorianCalendar = new GregorianCalendar(timeZone, Locale.US);
gregorianCalendar.setTime(date);
StringBuilder sb = new StringBuilder(19 + (z ? 4 : 0) + (timeZone.getRawOffset() == 0 ? 1 : 6));
padInt(sb, gregorianCalendar.get(1), 4);
sb.append('-');
padInt(sb, gregorianCalendar.get(2) + 1, 2);
sb.append('-');
padInt(sb, gregorianCalendar.get(5), 2);
sb.append('T');
padInt(sb, gregorianCalendar.get(11), 2);
sb.append(':');
padInt(sb, gregorianCalendar.get(12), 2);
sb.append(':');
padInt(sb, gregorianCalendar.get(13), 2);
if (z) {
sb.append('.');
padInt(sb, gregorianCalendar.get(14), 3);
}
int offset = timeZone.getOffset(gregorianCalendar.getTimeInMillis());
if (offset != 0) {
int i = offset / MBridgeCommon.DEFAULT_LOAD_TIMEOUT;
int abs = Math.abs(i / 60);
int abs2 = Math.abs(i % 60);
sb.append(offset >= 0 ? '+' : '-');
padInt(sb, abs, 2);
sb.append(':');
padInt(sb, abs2, 2);
} else {
sb.append('Z');
}
return sb.toString();
}
/* JADX WARN: Removed duplicated region for block: B:82:0x01cf */
/* JADX WARN: Removed duplicated region for block: B:85:0x01eb */
/* JADX WARN: Removed duplicated region for block: B:90:0x01d1 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static java.util.Date parse(java.lang.String r19, java.text.ParsePosition r20) throws java.text.ParseException {
/*
Method dump skipped, instructions count: 565
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.gson.internal.bind.util.ISO8601Utils.parse(java.lang.String, java.text.ParsePosition):java.util.Date");
}
private static boolean checkOffset(String str, int i, char c) {
return i < str.length() && str.charAt(i) == c;
}
private static int parseInt(String str, int i, int i2) throws NumberFormatException {
int i3;
int i4;
if (i < 0 || i2 > str.length() || i > i2) {
throw new NumberFormatException(str);
}
if (i < i2) {
i4 = i + 1;
int digit = Character.digit(str.charAt(i), 10);
if (digit < 0) {
throw new NumberFormatException("Invalid number: " + str.substring(i, i2));
}
i3 = -digit;
} else {
i3 = 0;
i4 = i;
}
while (i4 < i2) {
int i5 = i4 + 1;
int digit2 = Character.digit(str.charAt(i4), 10);
if (digit2 < 0) {
throw new NumberFormatException("Invalid number: " + str.substring(i, i2));
}
i3 = (i3 * 10) - digit2;
i4 = i5;
}
return -i3;
}
private static void padInt(StringBuilder sb, int i, int i2) {
String num = Integer.toString(i);
for (int length = i2 - num.length(); length > 0; length--) {
sb.append('0');
}
sb.append(num);
}
private static int indexOfNonDigit(String str, int i) {
while (i < str.length()) {
char charAt = str.charAt(i);
if (charAt < '0' || charAt > '9') {
return i;
}
i++;
}
return str.length();
}
}

View File

@@ -0,0 +1,11 @@
package com.google.gson.internal.reflect;
import java.lang.reflect.AccessibleObject;
/* loaded from: classes3.dex */
final class PreJava9ReflectionAccessor extends ReflectionAccessor {
@Override // com.google.gson.internal.reflect.ReflectionAccessor
public void makeAccessible(AccessibleObject accessibleObject) {
accessibleObject.setAccessible(true);
}
}

View File

@@ -0,0 +1,19 @@
package com.google.gson.internal.reflect;
import com.google.gson.internal.JavaVersion;
import java.lang.reflect.AccessibleObject;
/* loaded from: classes3.dex */
public abstract class ReflectionAccessor {
private static final ReflectionAccessor instance;
public static ReflectionAccessor getInstance() {
return instance;
}
public abstract void makeAccessible(AccessibleObject accessibleObject);
static {
instance = JavaVersion.getMajorJavaVersion() < 9 ? new PreJava9ReflectionAccessor() : new UnsafeReflectionAccessor();
}
}

View File

@@ -0,0 +1,55 @@
package com.google.gson.internal.reflect;
import com.google.gson.JsonIOException;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
/* loaded from: classes3.dex */
final class UnsafeReflectionAccessor extends ReflectionAccessor {
private static Class unsafeClass;
private final Object theUnsafe = getUnsafeInstance();
private final Field overrideField = getOverrideField();
@Override // com.google.gson.internal.reflect.ReflectionAccessor
public void makeAccessible(AccessibleObject accessibleObject) {
if (makeAccessibleWithUnsafe(accessibleObject)) {
return;
}
try {
accessibleObject.setAccessible(true);
} catch (SecurityException e) {
throw new JsonIOException("Gson couldn't modify fields for " + accessibleObject + "\nand sun.misc.Unsafe not found.\nEither write a custom type adapter, or make fields accessible, or include sun.misc.Unsafe.", e);
}
}
public boolean makeAccessibleWithUnsafe(AccessibleObject accessibleObject) {
if (this.theUnsafe != null && this.overrideField != null) {
try {
unsafeClass.getMethod("putBoolean", Object.class, Long.TYPE, Boolean.TYPE).invoke(this.theUnsafe, accessibleObject, Long.valueOf(((Long) unsafeClass.getMethod("objectFieldOffset", Field.class).invoke(this.theUnsafe, this.overrideField)).longValue()), Boolean.TRUE);
return true;
} catch (Exception unused) {
}
}
return false;
}
private static Object getUnsafeInstance() {
try {
Class<?> cls = Class.forName("sun.misc.Unsafe");
unsafeClass = cls;
Field declaredField = cls.getDeclaredField("theUnsafe");
declaredField.setAccessible(true);
return declaredField.get(null);
} catch (Exception unused) {
return null;
}
}
private static Field getOverrideField() {
try {
return AccessibleObject.class.getDeclaredField("override");
} catch (Exception unused) {
return null;
}
}
}

View File

@@ -0,0 +1,52 @@
package com.google.gson.internal.sql;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.sql.Date;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/* loaded from: classes3.dex */
final class SqlDateTypeAdapter extends TypeAdapter<Date> {
static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { // from class: com.google.gson.internal.sql.SqlDateTypeAdapter.1
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
if (typeToken.getRawType() == Date.class) {
return new SqlDateTypeAdapter();
}
return null;
}
};
private final DateFormat format;
private SqlDateTypeAdapter() {
this.format = new SimpleDateFormat("MMM d, yyyy");
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read, reason: avoid collision after fix types in other method */
public synchronized Date read2(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
try {
return new Date(this.format.parse(jsonReader.nextString()).getTime());
} catch (ParseException e) {
throw new JsonSyntaxException(e);
}
}
@Override // com.google.gson.TypeAdapter
public synchronized void write(JsonWriter jsonWriter, Date date) throws IOException {
jsonWriter.value(date == null ? null : this.format.format((java.util.Date) date));
}
}

View File

@@ -0,0 +1,53 @@
package com.google.gson.internal.sql;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.sql.Time;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/* loaded from: classes3.dex */
final class SqlTimeTypeAdapter extends TypeAdapter<Time> {
static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { // from class: com.google.gson.internal.sql.SqlTimeTypeAdapter.1
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
if (typeToken.getRawType() == Time.class) {
return new SqlTimeTypeAdapter();
}
return null;
}
};
private final DateFormat format;
private SqlTimeTypeAdapter() {
this.format = new SimpleDateFormat("hh:mm:ss a");
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read, reason: avoid collision after fix types in other method */
public synchronized Time read2(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
try {
return new Time(this.format.parse(jsonReader.nextString()).getTime());
} catch (ParseException e) {
throw new JsonSyntaxException(e);
}
}
@Override // com.google.gson.TypeAdapter
public synchronized void write(JsonWriter jsonWriter, Time time) throws IOException {
jsonWriter.value(time == null ? null : this.format.format((Date) time));
}
}

View File

@@ -0,0 +1,44 @@
package com.google.gson.internal.sql;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.Date;
/* loaded from: classes3.dex */
class SqlTimestampTypeAdapter extends TypeAdapter<Timestamp> {
static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() { // from class: com.google.gson.internal.sql.SqlTimestampTypeAdapter.1
@Override // com.google.gson.TypeAdapterFactory
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
if (typeToken.getRawType() == Timestamp.class) {
return new SqlTimestampTypeAdapter(gson.getAdapter(Date.class));
}
return null;
}
};
private final TypeAdapter<Date> dateTypeAdapter;
private SqlTimestampTypeAdapter(TypeAdapter<Date> typeAdapter) {
this.dateTypeAdapter = typeAdapter;
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read, reason: avoid collision after fix types in other method */
public Timestamp read2(JsonReader jsonReader) throws IOException {
Date read2 = this.dateTypeAdapter.read2(jsonReader);
if (read2 != null) {
return new Timestamp(read2.getTime());
}
return null;
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, Timestamp timestamp) throws IOException {
this.dateTypeAdapter.write(jsonWriter, timestamp);
}
}

View File

@@ -0,0 +1,55 @@
package com.google.gson.internal.sql;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.internal.bind.DefaultDateTypeAdapter;
import java.sql.Timestamp;
import java.util.Date;
/* loaded from: classes3.dex */
public final class SqlTypesSupport {
public static final DefaultDateTypeAdapter.DateType<? extends Date> DATE_DATE_TYPE;
public static final TypeAdapterFactory DATE_FACTORY;
public static final boolean SUPPORTS_SQL_TYPES;
public static final DefaultDateTypeAdapter.DateType<? extends Date> TIMESTAMP_DATE_TYPE;
public static final TypeAdapterFactory TIMESTAMP_FACTORY;
public static final TypeAdapterFactory TIME_FACTORY;
static {
boolean z;
try {
Class.forName("java.sql.Date");
z = true;
} catch (ClassNotFoundException unused) {
z = false;
}
SUPPORTS_SQL_TYPES = z;
if (z) {
DATE_DATE_TYPE = new DefaultDateTypeAdapter.DateType<java.sql.Date>(java.sql.Date.class) { // from class: com.google.gson.internal.sql.SqlTypesSupport.1
/* JADX WARN: Can't rename method to resolve collision */
@Override // com.google.gson.internal.bind.DefaultDateTypeAdapter.DateType
public java.sql.Date deserialize(Date date) {
return new java.sql.Date(date.getTime());
}
};
TIMESTAMP_DATE_TYPE = new DefaultDateTypeAdapter.DateType<Timestamp>(Timestamp.class) { // from class: com.google.gson.internal.sql.SqlTypesSupport.2
/* JADX WARN: Can't rename method to resolve collision */
@Override // com.google.gson.internal.bind.DefaultDateTypeAdapter.DateType
public Timestamp deserialize(Date date) {
return new Timestamp(date.getTime());
}
};
DATE_FACTORY = SqlDateTypeAdapter.FACTORY;
TIME_FACTORY = SqlTimeTypeAdapter.FACTORY;
TIMESTAMP_FACTORY = SqlTimestampTypeAdapter.FACTORY;
return;
}
DATE_DATE_TYPE = null;
TIMESTAMP_DATE_TYPE = null;
DATE_FACTORY = null;
TIME_FACTORY = null;
TIMESTAMP_FACTORY = null;
}
private SqlTypesSupport() {
}
}