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,8 @@
package com.google.gson;
/* loaded from: classes3.dex */
public interface ExclusionStrategy {
boolean shouldSkipClass(Class<?> cls);
boolean shouldSkipField(FieldAttributes fieldAttributes);
}

View File

@@ -0,0 +1,54 @@
package com.google.gson;
import com.google.gson.internal.C$Gson$Preconditions;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collection;
/* loaded from: classes3.dex */
public final class FieldAttributes {
private final Field field;
public FieldAttributes(Field field) {
C$Gson$Preconditions.checkNotNull(field);
this.field = field;
}
public Class<?> getDeclaringClass() {
return this.field.getDeclaringClass();
}
public String getName() {
return this.field.getName();
}
public Type getDeclaredType() {
return this.field.getGenericType();
}
public Class<?> getDeclaredClass() {
return this.field.getType();
}
public <T extends Annotation> T getAnnotation(Class<T> cls) {
return (T) this.field.getAnnotation(cls);
}
public Collection<Annotation> getAnnotations() {
return Arrays.asList(this.field.getAnnotations());
}
public boolean hasModifier(int i) {
return (i & this.field.getModifiers()) != 0;
}
public Object get(Object obj) throws IllegalAccessException {
return this.field.get(obj);
}
public boolean isSynthetic() {
return this.field.isSynthetic();
}
}

View File

@@ -0,0 +1,75 @@
package com.google.gson;
import csdk.gluads.Consts;
import java.lang.reflect.Field;
import java.util.Locale;
/* loaded from: classes3.dex */
public enum FieldNamingPolicy implements FieldNamingStrategy {
IDENTITY { // from class: com.google.gson.FieldNamingPolicy.1
@Override // com.google.gson.FieldNamingStrategy
public String translateName(Field field) {
return field.getName();
}
},
UPPER_CAMEL_CASE { // from class: com.google.gson.FieldNamingPolicy.2
@Override // com.google.gson.FieldNamingStrategy
public String translateName(Field field) {
return FieldNamingPolicy.upperCaseFirstLetter(field.getName());
}
},
UPPER_CAMEL_CASE_WITH_SPACES { // from class: com.google.gson.FieldNamingPolicy.3
@Override // com.google.gson.FieldNamingStrategy
public String translateName(Field field) {
return FieldNamingPolicy.upperCaseFirstLetter(FieldNamingPolicy.separateCamelCase(field.getName(), " "));
}
},
LOWER_CASE_WITH_UNDERSCORES { // from class: com.google.gson.FieldNamingPolicy.4
@Override // com.google.gson.FieldNamingStrategy
public String translateName(Field field) {
return FieldNamingPolicy.separateCamelCase(field.getName(), "_").toLowerCase(Locale.ENGLISH);
}
},
LOWER_CASE_WITH_DASHES { // from class: com.google.gson.FieldNamingPolicy.5
@Override // com.google.gson.FieldNamingStrategy
public String translateName(Field field) {
return FieldNamingPolicy.separateCamelCase(field.getName(), "-").toLowerCase(Locale.ENGLISH);
}
},
LOWER_CASE_WITH_DOTS { // from class: com.google.gson.FieldNamingPolicy.6
@Override // com.google.gson.FieldNamingStrategy
public String translateName(Field field) {
return FieldNamingPolicy.separateCamelCase(field.getName(), Consts.STRING_PERIOD).toLowerCase(Locale.ENGLISH);
}
};
public static String separateCamelCase(String str, String str2) {
StringBuilder sb = new StringBuilder();
int length = str.length();
for (int i = 0; i < length; i++) {
char charAt = str.charAt(i);
if (Character.isUpperCase(charAt) && sb.length() != 0) {
sb.append(str2);
}
sb.append(charAt);
}
return sb.toString();
}
public static String upperCaseFirstLetter(String str) {
int length = str.length() - 1;
int i = 0;
while (!Character.isLetter(str.charAt(i)) && i < length) {
i++;
}
char charAt = str.charAt(i);
if (Character.isUpperCase(charAt)) {
return str;
}
char upperCase = Character.toUpperCase(charAt);
if (i == 0) {
return upperCase + str.substring(1);
}
return str.substring(0, i) + upperCase + str.substring(i + 1);
}
}

View File

@@ -0,0 +1,8 @@
package com.google.gson;
import java.lang.reflect.Field;
/* loaded from: classes3.dex */
public interface FieldNamingStrategy {
String translateName(Field field);
}

View File

@@ -0,0 +1,609 @@
package com.google.gson;
import com.google.gson.internal.ConstructorConstructor;
import com.google.gson.internal.Excluder;
import com.google.gson.internal.Primitives;
import com.google.gson.internal.Streams;
import com.google.gson.internal.bind.ArrayTypeAdapter;
import com.google.gson.internal.bind.CollectionTypeAdapterFactory;
import com.google.gson.internal.bind.DateTypeAdapter;
import com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory;
import com.google.gson.internal.bind.JsonTreeReader;
import com.google.gson.internal.bind.JsonTreeWriter;
import com.google.gson.internal.bind.MapTypeAdapterFactory;
import com.google.gson.internal.bind.NumberTypeAdapter;
import com.google.gson.internal.bind.ObjectTypeAdapter;
import com.google.gson.internal.bind.ReflectiveTypeAdapterFactory;
import com.google.gson.internal.bind.TypeAdapters;
import com.google.gson.internal.sql.SqlTypesSupport;
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 com.google.gson.stream.MalformedJsonException;
import java.io.EOFException;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicLongArray;
/* loaded from: classes3.dex */
public final class Gson {
static final boolean DEFAULT_COMPLEX_MAP_KEYS = false;
static final boolean DEFAULT_ESCAPE_HTML = true;
static final boolean DEFAULT_JSON_NON_EXECUTABLE = false;
static final boolean DEFAULT_LENIENT = false;
static final boolean DEFAULT_PRETTY_PRINT = false;
static final boolean DEFAULT_SERIALIZE_NULLS = false;
static final boolean DEFAULT_SPECIALIZE_FLOAT_VALUES = false;
private static final String JSON_NON_EXECUTABLE_PREFIX = ")]}'\n";
private static final TypeToken<?> NULL_KEY_SURROGATE = TypeToken.get(Object.class);
final List<TypeAdapterFactory> builderFactories;
final List<TypeAdapterFactory> builderHierarchyFactories;
private final ThreadLocal<Map<TypeToken<?>, FutureTypeAdapter<?>>> calls;
final boolean complexMapKeySerialization;
private final ConstructorConstructor constructorConstructor;
final String datePattern;
final int dateStyle;
final Excluder excluder;
final List<TypeAdapterFactory> factories;
final FieldNamingStrategy fieldNamingStrategy;
final boolean generateNonExecutableJson;
final boolean htmlSafe;
final Map<Type, InstanceCreator<?>> instanceCreators;
private final JsonAdapterAnnotationTypeAdapterFactory jsonAdapterFactory;
final boolean lenient;
final LongSerializationPolicy longSerializationPolicy;
final ToNumberStrategy numberToNumberStrategy;
final ToNumberStrategy objectToNumberStrategy;
final boolean prettyPrinting;
final boolean serializeNulls;
final boolean serializeSpecialFloatingPointValues;
final int timeStyle;
private final Map<TypeToken<?>, TypeAdapter<?>> typeTokenCache;
@Deprecated
public Excluder excluder() {
return this.excluder;
}
public FieldNamingStrategy fieldNamingStrategy() {
return this.fieldNamingStrategy;
}
public boolean htmlSafe() {
return this.htmlSafe;
}
public boolean serializeNulls() {
return this.serializeNulls;
}
public Gson() {
this(Excluder.DEFAULT, FieldNamingPolicy.IDENTITY, Collections.emptyMap(), false, false, false, true, false, false, false, LongSerializationPolicy.DEFAULT, null, 2, 2, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), ToNumberPolicy.DOUBLE, ToNumberPolicy.LAZILY_PARSED_NUMBER);
}
public Gson(Excluder excluder, FieldNamingStrategy fieldNamingStrategy, Map<Type, InstanceCreator<?>> map, boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, LongSerializationPolicy longSerializationPolicy, String str, int i, int i2, List<TypeAdapterFactory> list, List<TypeAdapterFactory> list2, List<TypeAdapterFactory> list3, ToNumberStrategy toNumberStrategy, ToNumberStrategy toNumberStrategy2) {
this.calls = new ThreadLocal<>();
this.typeTokenCache = new ConcurrentHashMap();
this.excluder = excluder;
this.fieldNamingStrategy = fieldNamingStrategy;
this.instanceCreators = map;
ConstructorConstructor constructorConstructor = new ConstructorConstructor(map);
this.constructorConstructor = constructorConstructor;
this.serializeNulls = z;
this.complexMapKeySerialization = z2;
this.generateNonExecutableJson = z3;
this.htmlSafe = z4;
this.prettyPrinting = z5;
this.lenient = z6;
this.serializeSpecialFloatingPointValues = z7;
this.longSerializationPolicy = longSerializationPolicy;
this.datePattern = str;
this.dateStyle = i;
this.timeStyle = i2;
this.builderFactories = list;
this.builderHierarchyFactories = list2;
this.objectToNumberStrategy = toNumberStrategy;
this.numberToNumberStrategy = toNumberStrategy2;
ArrayList arrayList = new ArrayList();
arrayList.add(TypeAdapters.JSON_ELEMENT_FACTORY);
arrayList.add(ObjectTypeAdapter.getFactory(toNumberStrategy));
arrayList.add(excluder);
arrayList.addAll(list3);
arrayList.add(TypeAdapters.STRING_FACTORY);
arrayList.add(TypeAdapters.INTEGER_FACTORY);
arrayList.add(TypeAdapters.BOOLEAN_FACTORY);
arrayList.add(TypeAdapters.BYTE_FACTORY);
arrayList.add(TypeAdapters.SHORT_FACTORY);
TypeAdapter<Number> longAdapter = longAdapter(longSerializationPolicy);
arrayList.add(TypeAdapters.newFactory(Long.TYPE, Long.class, longAdapter));
arrayList.add(TypeAdapters.newFactory(Double.TYPE, Double.class, doubleAdapter(z7)));
arrayList.add(TypeAdapters.newFactory(Float.TYPE, Float.class, floatAdapter(z7)));
arrayList.add(NumberTypeAdapter.getFactory(toNumberStrategy2));
arrayList.add(TypeAdapters.ATOMIC_INTEGER_FACTORY);
arrayList.add(TypeAdapters.ATOMIC_BOOLEAN_FACTORY);
arrayList.add(TypeAdapters.newFactory(AtomicLong.class, atomicLongAdapter(longAdapter)));
arrayList.add(TypeAdapters.newFactory(AtomicLongArray.class, atomicLongArrayAdapter(longAdapter)));
arrayList.add(TypeAdapters.ATOMIC_INTEGER_ARRAY_FACTORY);
arrayList.add(TypeAdapters.CHARACTER_FACTORY);
arrayList.add(TypeAdapters.STRING_BUILDER_FACTORY);
arrayList.add(TypeAdapters.STRING_BUFFER_FACTORY);
arrayList.add(TypeAdapters.newFactory(BigDecimal.class, TypeAdapters.BIG_DECIMAL));
arrayList.add(TypeAdapters.newFactory(BigInteger.class, TypeAdapters.BIG_INTEGER));
arrayList.add(TypeAdapters.URL_FACTORY);
arrayList.add(TypeAdapters.URI_FACTORY);
arrayList.add(TypeAdapters.UUID_FACTORY);
arrayList.add(TypeAdapters.CURRENCY_FACTORY);
arrayList.add(TypeAdapters.LOCALE_FACTORY);
arrayList.add(TypeAdapters.INET_ADDRESS_FACTORY);
arrayList.add(TypeAdapters.BIT_SET_FACTORY);
arrayList.add(DateTypeAdapter.FACTORY);
arrayList.add(TypeAdapters.CALENDAR_FACTORY);
if (SqlTypesSupport.SUPPORTS_SQL_TYPES) {
arrayList.add(SqlTypesSupport.TIME_FACTORY);
arrayList.add(SqlTypesSupport.DATE_FACTORY);
arrayList.add(SqlTypesSupport.TIMESTAMP_FACTORY);
}
arrayList.add(ArrayTypeAdapter.FACTORY);
arrayList.add(TypeAdapters.CLASS_FACTORY);
arrayList.add(new CollectionTypeAdapterFactory(constructorConstructor));
arrayList.add(new MapTypeAdapterFactory(constructorConstructor, z2));
JsonAdapterAnnotationTypeAdapterFactory jsonAdapterAnnotationTypeAdapterFactory = new JsonAdapterAnnotationTypeAdapterFactory(constructorConstructor);
this.jsonAdapterFactory = jsonAdapterAnnotationTypeAdapterFactory;
arrayList.add(jsonAdapterAnnotationTypeAdapterFactory);
arrayList.add(TypeAdapters.ENUM_FACTORY);
arrayList.add(new ReflectiveTypeAdapterFactory(constructorConstructor, fieldNamingStrategy, excluder, jsonAdapterAnnotationTypeAdapterFactory));
this.factories = Collections.unmodifiableList(arrayList);
}
public GsonBuilder newBuilder() {
return new GsonBuilder(this);
}
private TypeAdapter<Number> doubleAdapter(boolean z) {
if (z) {
return TypeAdapters.DOUBLE;
}
return new TypeAdapter<Number>() { // from class: com.google.gson.Gson.1
@Override // com.google.gson.TypeAdapter
/* renamed from: read, reason: merged with bridge method [inline-methods] */
public Number read2(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
return Double.valueOf(jsonReader.nextDouble());
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, Number number) throws IOException {
if (number == null) {
jsonWriter.nullValue();
} else {
Gson.checkValidFloatingPoint(number.doubleValue());
jsonWriter.value(number);
}
}
};
}
private TypeAdapter<Number> floatAdapter(boolean z) {
if (z) {
return TypeAdapters.FLOAT;
}
return new TypeAdapter<Number>() { // from class: com.google.gson.Gson.2
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public Number read2(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
return Float.valueOf((float) jsonReader.nextDouble());
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, Number number) throws IOException {
if (number == null) {
jsonWriter.nullValue();
} else {
Gson.checkValidFloatingPoint(number.floatValue());
jsonWriter.value(number);
}
}
};
}
public static void checkValidFloatingPoint(double d) {
if (Double.isNaN(d) || Double.isInfinite(d)) {
throw new IllegalArgumentException(d + " is not a valid double value as per JSON specification. To override this behavior, use GsonBuilder.serializeSpecialFloatingPointValues() method.");
}
}
private static TypeAdapter<Number> longAdapter(LongSerializationPolicy longSerializationPolicy) {
if (longSerializationPolicy == LongSerializationPolicy.DEFAULT) {
return TypeAdapters.LONG;
}
return new TypeAdapter<Number>() { // from class: com.google.gson.Gson.3
/* JADX WARN: Can't rename method to resolve collision */
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public Number read2(JsonReader jsonReader) throws IOException {
if (jsonReader.peek() == JsonToken.NULL) {
jsonReader.nextNull();
return null;
}
return Long.valueOf(jsonReader.nextLong());
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, Number number) throws IOException {
if (number == null) {
jsonWriter.nullValue();
} else {
jsonWriter.value(number.toString());
}
}
};
}
private static TypeAdapter<AtomicLong> atomicLongAdapter(final TypeAdapter<Number> typeAdapter) {
return new TypeAdapter<AtomicLong>() { // from class: com.google.gson.Gson.4
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, AtomicLong atomicLong) throws IOException {
TypeAdapter.this.write(jsonWriter, Long.valueOf(atomicLong.get()));
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read, reason: avoid collision after fix types in other method */
public AtomicLong read2(JsonReader jsonReader) throws IOException {
return new AtomicLong(((Number) TypeAdapter.this.read2(jsonReader)).longValue());
}
}.nullSafe();
}
private static TypeAdapter<AtomicLongArray> atomicLongArrayAdapter(final TypeAdapter<Number> typeAdapter) {
return new TypeAdapter<AtomicLongArray>() { // from class: com.google.gson.Gson.5
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, AtomicLongArray atomicLongArray) throws IOException {
jsonWriter.beginArray();
int length = atomicLongArray.length();
for (int i = 0; i < length; i++) {
TypeAdapter.this.write(jsonWriter, Long.valueOf(atomicLongArray.get(i)));
}
jsonWriter.endArray();
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read, reason: avoid collision after fix types in other method */
public AtomicLongArray read2(JsonReader jsonReader) throws IOException {
ArrayList arrayList = new ArrayList();
jsonReader.beginArray();
while (jsonReader.hasNext()) {
arrayList.add(Long.valueOf(((Number) TypeAdapter.this.read2(jsonReader)).longValue()));
}
jsonReader.endArray();
int size = arrayList.size();
AtomicLongArray atomicLongArray = new AtomicLongArray(size);
for (int i = 0; i < size; i++) {
atomicLongArray.set(i, ((Long) arrayList.get(i)).longValue());
}
return atomicLongArray;
}
}.nullSafe();
}
public <T> TypeAdapter<T> getAdapter(TypeToken<T> typeToken) {
boolean z;
TypeAdapter<T> typeAdapter = (TypeAdapter) this.typeTokenCache.get(typeToken == null ? NULL_KEY_SURROGATE : typeToken);
if (typeAdapter != null) {
return typeAdapter;
}
Map<TypeToken<?>, FutureTypeAdapter<?>> map = this.calls.get();
if (map == null) {
map = new HashMap<>();
this.calls.set(map);
z = true;
} else {
z = false;
}
FutureTypeAdapter<?> futureTypeAdapter = map.get(typeToken);
if (futureTypeAdapter != null) {
return futureTypeAdapter;
}
try {
FutureTypeAdapter<?> futureTypeAdapter2 = new FutureTypeAdapter<>();
map.put(typeToken, futureTypeAdapter2);
Iterator<TypeAdapterFactory> it = this.factories.iterator();
while (it.hasNext()) {
TypeAdapter<T> create = it.next().create(this, typeToken);
if (create != null) {
futureTypeAdapter2.setDelegate(create);
this.typeTokenCache.put(typeToken, create);
return create;
}
}
throw new IllegalArgumentException("GSON (2.8.9) cannot handle " + typeToken);
} finally {
map.remove(typeToken);
if (z) {
this.calls.remove();
}
}
}
public <T> TypeAdapter<T> getDelegateAdapter(TypeAdapterFactory typeAdapterFactory, TypeToken<T> typeToken) {
if (!this.factories.contains(typeAdapterFactory)) {
typeAdapterFactory = this.jsonAdapterFactory;
}
boolean z = false;
for (TypeAdapterFactory typeAdapterFactory2 : this.factories) {
if (z) {
TypeAdapter<T> create = typeAdapterFactory2.create(this, typeToken);
if (create != null) {
return create;
}
} else if (typeAdapterFactory2 == typeAdapterFactory) {
z = true;
}
}
throw new IllegalArgumentException("GSON cannot serialize " + typeToken);
}
public <T> TypeAdapter<T> getAdapter(Class<T> cls) {
return getAdapter(TypeToken.get((Class) cls));
}
public JsonElement toJsonTree(Object obj) {
if (obj == null) {
return JsonNull.INSTANCE;
}
return toJsonTree(obj, obj.getClass());
}
public JsonElement toJsonTree(Object obj, Type type) {
JsonTreeWriter jsonTreeWriter = new JsonTreeWriter();
toJson(obj, type, jsonTreeWriter);
return jsonTreeWriter.get();
}
public String toJson(Object obj) {
if (obj == null) {
return toJson((JsonElement) JsonNull.INSTANCE);
}
return toJson(obj, obj.getClass());
}
public String toJson(Object obj, Type type) {
StringWriter stringWriter = new StringWriter();
toJson(obj, type, stringWriter);
return stringWriter.toString();
}
public void toJson(Object obj, Appendable appendable) throws JsonIOException {
if (obj != null) {
toJson(obj, obj.getClass(), appendable);
} else {
toJson((JsonElement) JsonNull.INSTANCE, appendable);
}
}
public void toJson(Object obj, Type type, Appendable appendable) throws JsonIOException {
try {
toJson(obj, type, newJsonWriter(Streams.writerForAppendable(appendable)));
} catch (IOException e) {
throw new JsonIOException(e);
}
}
public void toJson(Object obj, Type type, JsonWriter jsonWriter) throws JsonIOException {
TypeAdapter adapter = getAdapter(TypeToken.get(type));
boolean isLenient = jsonWriter.isLenient();
jsonWriter.setLenient(true);
boolean isHtmlSafe = jsonWriter.isHtmlSafe();
jsonWriter.setHtmlSafe(this.htmlSafe);
boolean serializeNulls = jsonWriter.getSerializeNulls();
jsonWriter.setSerializeNulls(this.serializeNulls);
try {
try {
adapter.write(jsonWriter, obj);
} catch (IOException e) {
throw new JsonIOException(e);
} catch (AssertionError e2) {
AssertionError assertionError = new AssertionError("AssertionError (GSON 2.8.9): " + e2.getMessage());
assertionError.initCause(e2);
throw assertionError;
}
} finally {
jsonWriter.setLenient(isLenient);
jsonWriter.setHtmlSafe(isHtmlSafe);
jsonWriter.setSerializeNulls(serializeNulls);
}
}
public String toJson(JsonElement jsonElement) {
StringWriter stringWriter = new StringWriter();
toJson(jsonElement, (Appendable) stringWriter);
return stringWriter.toString();
}
public void toJson(JsonElement jsonElement, Appendable appendable) throws JsonIOException {
try {
toJson(jsonElement, newJsonWriter(Streams.writerForAppendable(appendable)));
} catch (IOException e) {
throw new JsonIOException(e);
}
}
public JsonWriter newJsonWriter(Writer writer) throws IOException {
if (this.generateNonExecutableJson) {
writer.write(JSON_NON_EXECUTABLE_PREFIX);
}
JsonWriter jsonWriter = new JsonWriter(writer);
if (this.prettyPrinting) {
jsonWriter.setIndent(" ");
}
jsonWriter.setSerializeNulls(this.serializeNulls);
return jsonWriter;
}
public JsonReader newJsonReader(Reader reader) {
JsonReader jsonReader = new JsonReader(reader);
jsonReader.setLenient(this.lenient);
return jsonReader;
}
public void toJson(JsonElement jsonElement, JsonWriter jsonWriter) throws JsonIOException {
boolean isLenient = jsonWriter.isLenient();
jsonWriter.setLenient(true);
boolean isHtmlSafe = jsonWriter.isHtmlSafe();
jsonWriter.setHtmlSafe(this.htmlSafe);
boolean serializeNulls = jsonWriter.getSerializeNulls();
jsonWriter.setSerializeNulls(this.serializeNulls);
try {
try {
Streams.write(jsonElement, jsonWriter);
} catch (IOException e) {
throw new JsonIOException(e);
} catch (AssertionError e2) {
AssertionError assertionError = new AssertionError("AssertionError (GSON 2.8.9): " + e2.getMessage());
assertionError.initCause(e2);
throw assertionError;
}
} finally {
jsonWriter.setLenient(isLenient);
jsonWriter.setHtmlSafe(isHtmlSafe);
jsonWriter.setSerializeNulls(serializeNulls);
}
}
public <T> T fromJson(String str, Class<T> cls) throws JsonSyntaxException {
return (T) Primitives.wrap(cls).cast(fromJson(str, (Type) cls));
}
public <T> T fromJson(String str, Type type) throws JsonSyntaxException {
if (str == null) {
return null;
}
return (T) fromJson(new StringReader(str), type);
}
public <T> T fromJson(Reader reader, Class<T> cls) throws JsonSyntaxException, JsonIOException {
JsonReader newJsonReader = newJsonReader(reader);
Object fromJson = fromJson(newJsonReader, cls);
assertFullConsumption(fromJson, newJsonReader);
return (T) Primitives.wrap(cls).cast(fromJson);
}
public <T> T fromJson(Reader reader, Type type) throws JsonIOException, JsonSyntaxException {
JsonReader newJsonReader = newJsonReader(reader);
T t = (T) fromJson(newJsonReader, type);
assertFullConsumption(t, newJsonReader);
return t;
}
private static void assertFullConsumption(Object obj, JsonReader jsonReader) {
if (obj != null) {
try {
if (jsonReader.peek() == JsonToken.END_DOCUMENT) {
} else {
throw new JsonIOException("JSON document was not fully consumed.");
}
} catch (MalformedJsonException e) {
throw new JsonSyntaxException(e);
} catch (IOException e2) {
throw new JsonIOException(e2);
}
}
}
public <T> T fromJson(JsonReader jsonReader, Type type) throws JsonIOException, JsonSyntaxException {
boolean isLenient = jsonReader.isLenient();
boolean z = true;
jsonReader.setLenient(true);
try {
try {
try {
jsonReader.peek();
z = false;
return getAdapter(TypeToken.get(type)).read2(jsonReader);
} catch (EOFException e) {
if (!z) {
throw new JsonSyntaxException(e);
}
jsonReader.setLenient(isLenient);
return null;
} catch (IllegalStateException e2) {
throw new JsonSyntaxException(e2);
}
} catch (IOException e3) {
throw new JsonSyntaxException(e3);
} catch (AssertionError e4) {
AssertionError assertionError = new AssertionError("AssertionError (GSON 2.8.9): " + e4.getMessage());
assertionError.initCause(e4);
throw assertionError;
}
} finally {
jsonReader.setLenient(isLenient);
}
}
public <T> T fromJson(JsonElement jsonElement, Class<T> cls) throws JsonSyntaxException {
return (T) Primitives.wrap(cls).cast(fromJson(jsonElement, (Type) cls));
}
public <T> T fromJson(JsonElement jsonElement, Type type) throws JsonSyntaxException {
if (jsonElement == null) {
return null;
}
return (T) fromJson(new JsonTreeReader(jsonElement), type);
}
public static class FutureTypeAdapter<T> extends TypeAdapter<T> {
private TypeAdapter<T> delegate;
public void setDelegate(TypeAdapter<T> typeAdapter) {
if (this.delegate != null) {
throw new AssertionError();
}
this.delegate = typeAdapter;
}
@Override // com.google.gson.TypeAdapter
/* renamed from: read */
public T read2(JsonReader jsonReader) throws IOException {
TypeAdapter<T> typeAdapter = this.delegate;
if (typeAdapter == null) {
throw new IllegalStateException();
}
return typeAdapter.read2(jsonReader);
}
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, T t) throws IOException {
TypeAdapter<T> typeAdapter = this.delegate;
if (typeAdapter == null) {
throw new IllegalStateException();
}
typeAdapter.write(jsonWriter, t);
}
}
public String toString() {
return "{serializeNulls:" + this.serializeNulls + ",factories:" + this.factories + ",instanceCreators:" + this.constructorConstructor + "}";
}
}

View File

@@ -0,0 +1,290 @@
package com.google.gson;
import com.google.gson.internal.C$Gson$Preconditions;
import com.google.gson.internal.Excluder;
import com.google.gson.internal.bind.DefaultDateTypeAdapter;
import com.google.gson.internal.bind.TreeTypeAdapter;
import com.google.gson.internal.bind.TypeAdapters;
import com.google.gson.internal.sql.SqlTypesSupport;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes3.dex */
public final class GsonBuilder {
private boolean complexMapKeySerialization;
private String datePattern;
private int dateStyle;
private boolean escapeHtmlChars;
private Excluder excluder;
private final List<TypeAdapterFactory> factories;
private FieldNamingStrategy fieldNamingPolicy;
private boolean generateNonExecutableJson;
private final List<TypeAdapterFactory> hierarchyFactories;
private final Map<Type, InstanceCreator<?>> instanceCreators;
private boolean lenient;
private LongSerializationPolicy longSerializationPolicy;
private ToNumberStrategy numberToNumberStrategy;
private ToNumberStrategy objectToNumberStrategy;
private boolean prettyPrinting;
private boolean serializeNulls;
private boolean serializeSpecialFloatingPointValues;
private int timeStyle;
public GsonBuilder disableHtmlEscaping() {
this.escapeHtmlChars = false;
return this;
}
public GsonBuilder enableComplexMapKeySerialization() {
this.complexMapKeySerialization = true;
return this;
}
public GsonBuilder generateNonExecutableJson() {
this.generateNonExecutableJson = true;
return this;
}
public GsonBuilder serializeNulls() {
this.serializeNulls = true;
return this;
}
public GsonBuilder serializeSpecialFloatingPointValues() {
this.serializeSpecialFloatingPointValues = true;
return this;
}
public GsonBuilder setDateFormat(int i) {
this.dateStyle = i;
this.datePattern = null;
return this;
}
public GsonBuilder setDateFormat(int i, int i2) {
this.dateStyle = i;
this.timeStyle = i2;
this.datePattern = null;
return this;
}
public GsonBuilder setDateFormat(String str) {
this.datePattern = str;
return this;
}
public GsonBuilder setFieldNamingPolicy(FieldNamingPolicy fieldNamingPolicy) {
this.fieldNamingPolicy = fieldNamingPolicy;
return this;
}
public GsonBuilder setFieldNamingStrategy(FieldNamingStrategy fieldNamingStrategy) {
this.fieldNamingPolicy = fieldNamingStrategy;
return this;
}
public GsonBuilder setLenient() {
this.lenient = true;
return this;
}
public GsonBuilder setLongSerializationPolicy(LongSerializationPolicy longSerializationPolicy) {
this.longSerializationPolicy = longSerializationPolicy;
return this;
}
public GsonBuilder setNumberToNumberStrategy(ToNumberStrategy toNumberStrategy) {
this.numberToNumberStrategy = toNumberStrategy;
return this;
}
public GsonBuilder setObjectToNumberStrategy(ToNumberStrategy toNumberStrategy) {
this.objectToNumberStrategy = toNumberStrategy;
return this;
}
public GsonBuilder setPrettyPrinting() {
this.prettyPrinting = true;
return this;
}
public GsonBuilder() {
this.excluder = Excluder.DEFAULT;
this.longSerializationPolicy = LongSerializationPolicy.DEFAULT;
this.fieldNamingPolicy = FieldNamingPolicy.IDENTITY;
this.instanceCreators = new HashMap();
this.factories = new ArrayList();
this.hierarchyFactories = new ArrayList();
this.serializeNulls = false;
this.dateStyle = 2;
this.timeStyle = 2;
this.complexMapKeySerialization = false;
this.serializeSpecialFloatingPointValues = false;
this.escapeHtmlChars = true;
this.prettyPrinting = false;
this.generateNonExecutableJson = false;
this.lenient = false;
this.objectToNumberStrategy = ToNumberPolicy.DOUBLE;
this.numberToNumberStrategy = ToNumberPolicy.LAZILY_PARSED_NUMBER;
}
public GsonBuilder(Gson gson) {
this.excluder = Excluder.DEFAULT;
this.longSerializationPolicy = LongSerializationPolicy.DEFAULT;
this.fieldNamingPolicy = FieldNamingPolicy.IDENTITY;
HashMap hashMap = new HashMap();
this.instanceCreators = hashMap;
ArrayList arrayList = new ArrayList();
this.factories = arrayList;
ArrayList arrayList2 = new ArrayList();
this.hierarchyFactories = arrayList2;
this.serializeNulls = false;
this.dateStyle = 2;
this.timeStyle = 2;
this.complexMapKeySerialization = false;
this.serializeSpecialFloatingPointValues = false;
this.escapeHtmlChars = true;
this.prettyPrinting = false;
this.generateNonExecutableJson = false;
this.lenient = false;
this.objectToNumberStrategy = ToNumberPolicy.DOUBLE;
this.numberToNumberStrategy = ToNumberPolicy.LAZILY_PARSED_NUMBER;
this.excluder = gson.excluder;
this.fieldNamingPolicy = gson.fieldNamingStrategy;
hashMap.putAll(gson.instanceCreators);
this.serializeNulls = gson.serializeNulls;
this.complexMapKeySerialization = gson.complexMapKeySerialization;
this.generateNonExecutableJson = gson.generateNonExecutableJson;
this.escapeHtmlChars = gson.htmlSafe;
this.prettyPrinting = gson.prettyPrinting;
this.lenient = gson.lenient;
this.serializeSpecialFloatingPointValues = gson.serializeSpecialFloatingPointValues;
this.longSerializationPolicy = gson.longSerializationPolicy;
this.datePattern = gson.datePattern;
this.dateStyle = gson.dateStyle;
this.timeStyle = gson.timeStyle;
arrayList.addAll(gson.builderFactories);
arrayList2.addAll(gson.builderHierarchyFactories);
this.objectToNumberStrategy = gson.objectToNumberStrategy;
this.numberToNumberStrategy = gson.numberToNumberStrategy;
}
public GsonBuilder setVersion(double d) {
this.excluder = this.excluder.withVersion(d);
return this;
}
public GsonBuilder excludeFieldsWithModifiers(int... iArr) {
this.excluder = this.excluder.withModifiers(iArr);
return this;
}
public GsonBuilder excludeFieldsWithoutExposeAnnotation() {
this.excluder = this.excluder.excludeFieldsWithoutExposeAnnotation();
return this;
}
public GsonBuilder disableInnerClassSerialization() {
this.excluder = this.excluder.disableInnerClassSerialization();
return this;
}
public GsonBuilder setExclusionStrategies(ExclusionStrategy... exclusionStrategyArr) {
for (ExclusionStrategy exclusionStrategy : exclusionStrategyArr) {
this.excluder = this.excluder.withExclusionStrategy(exclusionStrategy, true, true);
}
return this;
}
public GsonBuilder addSerializationExclusionStrategy(ExclusionStrategy exclusionStrategy) {
this.excluder = this.excluder.withExclusionStrategy(exclusionStrategy, true, false);
return this;
}
public GsonBuilder addDeserializationExclusionStrategy(ExclusionStrategy exclusionStrategy) {
this.excluder = this.excluder.withExclusionStrategy(exclusionStrategy, false, true);
return this;
}
public GsonBuilder registerTypeAdapter(Type type, Object obj) {
boolean z = obj instanceof JsonSerializer;
C$Gson$Preconditions.checkArgument(z || (obj instanceof JsonDeserializer) || (obj instanceof InstanceCreator) || (obj instanceof TypeAdapter));
if (obj instanceof InstanceCreator) {
this.instanceCreators.put(type, (InstanceCreator) obj);
}
if (z || (obj instanceof JsonDeserializer)) {
this.factories.add(TreeTypeAdapter.newFactoryWithMatchRawType(TypeToken.get(type), obj));
}
if (obj instanceof TypeAdapter) {
this.factories.add(TypeAdapters.newFactory(TypeToken.get(type), (TypeAdapter) obj));
}
return this;
}
public GsonBuilder registerTypeAdapterFactory(TypeAdapterFactory typeAdapterFactory) {
this.factories.add(typeAdapterFactory);
return this;
}
public GsonBuilder registerTypeHierarchyAdapter(Class<?> cls, Object obj) {
boolean z = obj instanceof JsonSerializer;
C$Gson$Preconditions.checkArgument(z || (obj instanceof JsonDeserializer) || (obj instanceof TypeAdapter));
if ((obj instanceof JsonDeserializer) || z) {
this.hierarchyFactories.add(TreeTypeAdapter.newTypeHierarchyFactory(cls, obj));
}
if (obj instanceof TypeAdapter) {
this.factories.add(TypeAdapters.newTypeHierarchyFactory(cls, (TypeAdapter) obj));
}
return this;
}
public Gson create() {
List<TypeAdapterFactory> arrayList = new ArrayList<>(this.factories.size() + this.hierarchyFactories.size() + 3);
arrayList.addAll(this.factories);
Collections.reverse(arrayList);
ArrayList arrayList2 = new ArrayList(this.hierarchyFactories);
Collections.reverse(arrayList2);
arrayList.addAll(arrayList2);
addTypeAdaptersForDate(this.datePattern, this.dateStyle, this.timeStyle, arrayList);
return new Gson(this.excluder, this.fieldNamingPolicy, this.instanceCreators, this.serializeNulls, this.complexMapKeySerialization, this.generateNonExecutableJson, this.escapeHtmlChars, this.prettyPrinting, this.lenient, this.serializeSpecialFloatingPointValues, this.longSerializationPolicy, this.datePattern, this.dateStyle, this.timeStyle, this.factories, this.hierarchyFactories, arrayList, this.objectToNumberStrategy, this.numberToNumberStrategy);
}
private void addTypeAdaptersForDate(String str, int i, int i2, List<TypeAdapterFactory> list) {
TypeAdapterFactory typeAdapterFactory;
TypeAdapterFactory typeAdapterFactory2;
boolean z = SqlTypesSupport.SUPPORTS_SQL_TYPES;
TypeAdapterFactory typeAdapterFactory3 = null;
if (str != null && !str.trim().isEmpty()) {
typeAdapterFactory = DefaultDateTypeAdapter.DateType.DATE.createAdapterFactory(str);
if (z) {
typeAdapterFactory3 = SqlTypesSupport.TIMESTAMP_DATE_TYPE.createAdapterFactory(str);
typeAdapterFactory2 = SqlTypesSupport.DATE_DATE_TYPE.createAdapterFactory(str);
}
typeAdapterFactory2 = null;
} else {
if (i == 2 || i2 == 2) {
return;
}
TypeAdapterFactory createAdapterFactory = DefaultDateTypeAdapter.DateType.DATE.createAdapterFactory(i, i2);
if (z) {
typeAdapterFactory3 = SqlTypesSupport.TIMESTAMP_DATE_TYPE.createAdapterFactory(i, i2);
TypeAdapterFactory createAdapterFactory2 = SqlTypesSupport.DATE_DATE_TYPE.createAdapterFactory(i, i2);
typeAdapterFactory = createAdapterFactory;
typeAdapterFactory2 = createAdapterFactory2;
} else {
typeAdapterFactory = createAdapterFactory;
typeAdapterFactory2 = null;
}
}
list.add(typeAdapterFactory);
if (z) {
list.add(typeAdapterFactory3);
list.add(typeAdapterFactory2);
}
}
}

View File

@@ -0,0 +1,8 @@
package com.google.gson;
import java.lang.reflect.Type;
/* loaded from: classes3.dex */
public interface InstanceCreator<T> {
T createInstance(Type type);
}

View File

@@ -0,0 +1,197 @@
package com.google.gson;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes3.dex */
public final class JsonArray extends JsonElement implements Iterable<JsonElement> {
private final List<JsonElement> elements;
public JsonArray() {
this.elements = new ArrayList();
}
public JsonArray(int i) {
this.elements = new ArrayList(i);
}
@Override // com.google.gson.JsonElement
public JsonArray deepCopy() {
if (!this.elements.isEmpty()) {
JsonArray jsonArray = new JsonArray(this.elements.size());
Iterator<JsonElement> it = this.elements.iterator();
while (it.hasNext()) {
jsonArray.add(it.next().deepCopy());
}
return jsonArray;
}
return new JsonArray();
}
public void add(Boolean bool) {
this.elements.add(bool == null ? JsonNull.INSTANCE : new JsonPrimitive(bool));
}
public void add(Character ch) {
this.elements.add(ch == null ? JsonNull.INSTANCE : new JsonPrimitive(ch));
}
public void add(Number number) {
this.elements.add(number == null ? JsonNull.INSTANCE : new JsonPrimitive(number));
}
public void add(String str) {
this.elements.add(str == null ? JsonNull.INSTANCE : new JsonPrimitive(str));
}
public void add(JsonElement jsonElement) {
if (jsonElement == null) {
jsonElement = JsonNull.INSTANCE;
}
this.elements.add(jsonElement);
}
public void addAll(JsonArray jsonArray) {
this.elements.addAll(jsonArray.elements);
}
public JsonElement set(int i, JsonElement jsonElement) {
return this.elements.set(i, jsonElement);
}
public boolean remove(JsonElement jsonElement) {
return this.elements.remove(jsonElement);
}
public JsonElement remove(int i) {
return this.elements.remove(i);
}
public boolean contains(JsonElement jsonElement) {
return this.elements.contains(jsonElement);
}
public int size() {
return this.elements.size();
}
public boolean isEmpty() {
return this.elements.isEmpty();
}
@Override // java.lang.Iterable
public Iterator<JsonElement> iterator() {
return this.elements.iterator();
}
public JsonElement get(int i) {
return this.elements.get(i);
}
@Override // com.google.gson.JsonElement
public Number getAsNumber() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsNumber();
}
throw new IllegalStateException();
}
@Override // com.google.gson.JsonElement
public String getAsString() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsString();
}
throw new IllegalStateException();
}
@Override // com.google.gson.JsonElement
public double getAsDouble() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsDouble();
}
throw new IllegalStateException();
}
@Override // com.google.gson.JsonElement
public BigDecimal getAsBigDecimal() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsBigDecimal();
}
throw new IllegalStateException();
}
@Override // com.google.gson.JsonElement
public BigInteger getAsBigInteger() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsBigInteger();
}
throw new IllegalStateException();
}
@Override // com.google.gson.JsonElement
public float getAsFloat() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsFloat();
}
throw new IllegalStateException();
}
@Override // com.google.gson.JsonElement
public long getAsLong() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsLong();
}
throw new IllegalStateException();
}
@Override // com.google.gson.JsonElement
public int getAsInt() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsInt();
}
throw new IllegalStateException();
}
@Override // com.google.gson.JsonElement
public byte getAsByte() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsByte();
}
throw new IllegalStateException();
}
@Override // com.google.gson.JsonElement
public char getAsCharacter() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsCharacter();
}
throw new IllegalStateException();
}
@Override // com.google.gson.JsonElement
public short getAsShort() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsShort();
}
throw new IllegalStateException();
}
@Override // com.google.gson.JsonElement
public boolean getAsBoolean() {
if (this.elements.size() == 1) {
return this.elements.get(0).getAsBoolean();
}
throw new IllegalStateException();
}
public boolean equals(Object obj) {
return obj == this || ((obj instanceof JsonArray) && ((JsonArray) obj).elements.equals(this.elements));
}
public int hashCode() {
return this.elements.hashCode();
}
}

View File

@@ -0,0 +1,8 @@
package com.google.gson;
import java.lang.reflect.Type;
/* loaded from: classes3.dex */
public interface JsonDeserializationContext {
<T> T deserialize(JsonElement jsonElement, Type type) throws JsonParseException;
}

View File

@@ -0,0 +1,8 @@
package com.google.gson;
import java.lang.reflect.Type;
/* loaded from: classes3.dex */
public interface JsonDeserializer<T> {
T deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException;
}

View File

@@ -0,0 +1,118 @@
package com.google.gson;
import com.google.gson.internal.Streams;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.io.StringWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
/* loaded from: classes3.dex */
public abstract class JsonElement {
public abstract JsonElement deepCopy();
public boolean isJsonArray() {
return this instanceof JsonArray;
}
public boolean isJsonObject() {
return this instanceof JsonObject;
}
public boolean isJsonPrimitive() {
return this instanceof JsonPrimitive;
}
public boolean isJsonNull() {
return this instanceof JsonNull;
}
public JsonObject getAsJsonObject() {
if (isJsonObject()) {
return (JsonObject) this;
}
throw new IllegalStateException("Not a JSON Object: " + this);
}
public JsonArray getAsJsonArray() {
if (isJsonArray()) {
return (JsonArray) this;
}
throw new IllegalStateException("Not a JSON Array: " + this);
}
public JsonPrimitive getAsJsonPrimitive() {
if (isJsonPrimitive()) {
return (JsonPrimitive) this;
}
throw new IllegalStateException("Not a JSON Primitive: " + this);
}
public JsonNull getAsJsonNull() {
if (isJsonNull()) {
return (JsonNull) this;
}
throw new IllegalStateException("Not a JSON Null: " + this);
}
public boolean getAsBoolean() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public Number getAsNumber() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public String getAsString() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public double getAsDouble() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public float getAsFloat() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public long getAsLong() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public int getAsInt() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public byte getAsByte() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
@Deprecated
public char getAsCharacter() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public BigDecimal getAsBigDecimal() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public BigInteger getAsBigInteger() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public short getAsShort() {
throw new UnsupportedOperationException(getClass().getSimpleName());
}
public String toString() {
try {
StringWriter stringWriter = new StringWriter();
JsonWriter jsonWriter = new JsonWriter(stringWriter);
jsonWriter.setLenient(true);
Streams.write(this, jsonWriter);
return stringWriter.toString();
} catch (IOException e) {
throw new AssertionError(e);
}
}
}

View File

@@ -0,0 +1,18 @@
package com.google.gson;
/* loaded from: classes3.dex */
public final class JsonIOException extends JsonParseException {
private static final long serialVersionUID = 1;
public JsonIOException(String str) {
super(str);
}
public JsonIOException(String str, Throwable th) {
super(str, th);
}
public JsonIOException(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,23 @@
package com.google.gson;
/* loaded from: classes3.dex */
public final class JsonNull extends JsonElement {
public static final JsonNull INSTANCE = new JsonNull();
@Override // com.google.gson.JsonElement
public JsonNull deepCopy() {
return INSTANCE;
}
@Deprecated
public JsonNull() {
}
public int hashCode() {
return JsonNull.class.hashCode();
}
public boolean equals(Object obj) {
return this == obj || (obj instanceof JsonNull);
}
}

View File

@@ -0,0 +1,87 @@
package com.google.gson;
import com.google.gson.internal.LinkedTreeMap;
import java.util.Map;
import java.util.Set;
/* loaded from: classes3.dex */
public final class JsonObject extends JsonElement {
private final LinkedTreeMap<String, JsonElement> members = new LinkedTreeMap<>();
@Override // com.google.gson.JsonElement
public JsonObject deepCopy() {
JsonObject jsonObject = new JsonObject();
for (Map.Entry<String, JsonElement> entry : this.members.entrySet()) {
jsonObject.add(entry.getKey(), entry.getValue().deepCopy());
}
return jsonObject;
}
public void add(String str, JsonElement jsonElement) {
LinkedTreeMap<String, JsonElement> linkedTreeMap = this.members;
if (jsonElement == null) {
jsonElement = JsonNull.INSTANCE;
}
linkedTreeMap.put(str, jsonElement);
}
public JsonElement remove(String str) {
return this.members.remove(str);
}
public void addProperty(String str, String str2) {
add(str, str2 == null ? JsonNull.INSTANCE : new JsonPrimitive(str2));
}
public void addProperty(String str, Number number) {
add(str, number == null ? JsonNull.INSTANCE : new JsonPrimitive(number));
}
public void addProperty(String str, Boolean bool) {
add(str, bool == null ? JsonNull.INSTANCE : new JsonPrimitive(bool));
}
public void addProperty(String str, Character ch) {
add(str, ch == null ? JsonNull.INSTANCE : new JsonPrimitive(ch));
}
public Set<Map.Entry<String, JsonElement>> entrySet() {
return this.members.entrySet();
}
public Set<String> keySet() {
return this.members.keySet();
}
public int size() {
return this.members.size();
}
public boolean has(String str) {
return this.members.containsKey(str);
}
public JsonElement get(String str) {
return this.members.get(str);
}
public JsonPrimitive getAsJsonPrimitive(String str) {
return (JsonPrimitive) this.members.get(str);
}
public JsonArray getAsJsonArray(String str) {
return (JsonArray) this.members.get(str);
}
public JsonObject getAsJsonObject(String str) {
return (JsonObject) this.members.get(str);
}
public boolean equals(Object obj) {
return obj == this || ((obj instanceof JsonObject) && ((JsonObject) obj).members.equals(this.members));
}
public int hashCode() {
return this.members.hashCode();
}
}

View File

@@ -0,0 +1,18 @@
package com.google.gson;
/* loaded from: classes3.dex */
public class JsonParseException extends RuntimeException {
static final long serialVersionUID = -4086729973971783390L;
public JsonParseException(String str) {
super(str);
}
public JsonParseException(String str, Throwable th) {
super(str, th);
}
public JsonParseException(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,68 @@
package com.google.gson;
import com.google.gson.internal.Streams;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.MalformedJsonException;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
/* loaded from: classes3.dex */
public final class JsonParser {
@Deprecated
public JsonParser() {
}
public static JsonElement parseString(String str) throws JsonSyntaxException {
return parseReader(new StringReader(str));
}
public static JsonElement parseReader(Reader reader) throws JsonIOException, JsonSyntaxException {
try {
JsonReader jsonReader = new JsonReader(reader);
JsonElement parseReader = parseReader(jsonReader);
if (!parseReader.isJsonNull() && jsonReader.peek() != JsonToken.END_DOCUMENT) {
throw new JsonSyntaxException("Did not consume the entire document.");
}
return parseReader;
} catch (MalformedJsonException e) {
throw new JsonSyntaxException(e);
} catch (IOException e2) {
throw new JsonIOException(e2);
} catch (NumberFormatException e3) {
throw new JsonSyntaxException(e3);
}
}
public static JsonElement parseReader(JsonReader jsonReader) throws JsonIOException, JsonSyntaxException {
boolean isLenient = jsonReader.isLenient();
jsonReader.setLenient(true);
try {
try {
return Streams.parse(jsonReader);
} catch (OutOfMemoryError e) {
throw new JsonParseException("Failed parsing JSON source: " + jsonReader + " to Json", e);
} catch (StackOverflowError e2) {
throw new JsonParseException("Failed parsing JSON source: " + jsonReader + " to Json", e2);
}
} finally {
jsonReader.setLenient(isLenient);
}
}
@Deprecated
public JsonElement parse(String str) throws JsonSyntaxException {
return parseString(str);
}
@Deprecated
public JsonElement parse(Reader reader) throws JsonIOException, JsonSyntaxException {
return parseReader(reader);
}
@Deprecated
public JsonElement parse(JsonReader jsonReader) throws JsonIOException, JsonSyntaxException {
return parseReader(jsonReader);
}
}

View File

@@ -0,0 +1,169 @@
package com.google.gson;
import com.google.gson.internal.C$Gson$Preconditions;
import com.google.gson.internal.LazilyParsedNumber;
import java.math.BigDecimal;
import java.math.BigInteger;
/* loaded from: classes3.dex */
public final class JsonPrimitive extends JsonElement {
private final Object value;
@Override // com.google.gson.JsonElement
public JsonPrimitive deepCopy() {
return this;
}
public JsonPrimitive(Boolean bool) {
this.value = C$Gson$Preconditions.checkNotNull(bool);
}
public JsonPrimitive(Number number) {
this.value = C$Gson$Preconditions.checkNotNull(number);
}
public JsonPrimitive(String str) {
this.value = C$Gson$Preconditions.checkNotNull(str);
}
public JsonPrimitive(Character ch) {
this.value = ((Character) C$Gson$Preconditions.checkNotNull(ch)).toString();
}
public boolean isBoolean() {
return this.value instanceof Boolean;
}
@Override // com.google.gson.JsonElement
public boolean getAsBoolean() {
if (isBoolean()) {
return ((Boolean) this.value).booleanValue();
}
return Boolean.parseBoolean(getAsString());
}
public boolean isNumber() {
return this.value instanceof Number;
}
@Override // com.google.gson.JsonElement
public Number getAsNumber() {
Object obj = this.value;
return obj instanceof String ? new LazilyParsedNumber((String) obj) : (Number) obj;
}
public boolean isString() {
return this.value instanceof String;
}
@Override // com.google.gson.JsonElement
public String getAsString() {
if (isNumber()) {
return getAsNumber().toString();
}
if (isBoolean()) {
return ((Boolean) this.value).toString();
}
return (String) this.value;
}
@Override // com.google.gson.JsonElement
public double getAsDouble() {
return isNumber() ? getAsNumber().doubleValue() : Double.parseDouble(getAsString());
}
@Override // com.google.gson.JsonElement
public BigDecimal getAsBigDecimal() {
Object obj = this.value;
return obj instanceof BigDecimal ? (BigDecimal) obj : new BigDecimal(this.value.toString());
}
@Override // com.google.gson.JsonElement
public BigInteger getAsBigInteger() {
Object obj = this.value;
return obj instanceof BigInteger ? (BigInteger) obj : new BigInteger(this.value.toString());
}
@Override // com.google.gson.JsonElement
public float getAsFloat() {
return isNumber() ? getAsNumber().floatValue() : Float.parseFloat(getAsString());
}
@Override // com.google.gson.JsonElement
public long getAsLong() {
return isNumber() ? getAsNumber().longValue() : Long.parseLong(getAsString());
}
@Override // com.google.gson.JsonElement
public short getAsShort() {
return isNumber() ? getAsNumber().shortValue() : Short.parseShort(getAsString());
}
@Override // com.google.gson.JsonElement
public int getAsInt() {
return isNumber() ? getAsNumber().intValue() : Integer.parseInt(getAsString());
}
@Override // com.google.gson.JsonElement
public byte getAsByte() {
return isNumber() ? getAsNumber().byteValue() : Byte.parseByte(getAsString());
}
@Override // com.google.gson.JsonElement
public char getAsCharacter() {
return getAsString().charAt(0);
}
public int hashCode() {
long doubleToLongBits;
if (this.value == null) {
return 31;
}
if (isIntegral(this)) {
doubleToLongBits = getAsNumber().longValue();
} else {
Object obj = this.value;
if (obj instanceof Number) {
doubleToLongBits = Double.doubleToLongBits(getAsNumber().doubleValue());
} else {
return obj.hashCode();
}
}
return (int) ((doubleToLongBits >>> 32) ^ doubleToLongBits);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || JsonPrimitive.class != obj.getClass()) {
return false;
}
JsonPrimitive jsonPrimitive = (JsonPrimitive) obj;
if (this.value == null) {
return jsonPrimitive.value == null;
}
if (isIntegral(this) && isIntegral(jsonPrimitive)) {
return getAsNumber().longValue() == jsonPrimitive.getAsNumber().longValue();
}
Object obj2 = this.value;
if ((obj2 instanceof Number) && (jsonPrimitive.value instanceof Number)) {
double doubleValue = getAsNumber().doubleValue();
double doubleValue2 = jsonPrimitive.getAsNumber().doubleValue();
if (doubleValue != doubleValue2) {
return Double.isNaN(doubleValue) && Double.isNaN(doubleValue2);
}
return true;
}
return obj2.equals(jsonPrimitive.value);
}
private static boolean isIntegral(JsonPrimitive jsonPrimitive) {
Object obj = jsonPrimitive.value;
if (!(obj instanceof Number)) {
return false;
}
Number number = (Number) obj;
return (number instanceof BigInteger) || (number instanceof Long) || (number instanceof Integer) || (number instanceof Short) || (number instanceof Byte);
}
}

View File

@@ -0,0 +1,10 @@
package com.google.gson;
import java.lang.reflect.Type;
/* loaded from: classes3.dex */
public interface JsonSerializationContext {
JsonElement serialize(Object obj);
JsonElement serialize(Object obj, Type type);
}

View File

@@ -0,0 +1,8 @@
package com.google.gson;
import java.lang.reflect.Type;
/* loaded from: classes3.dex */
public interface JsonSerializer<T> {
JsonElement serialize(T t, Type type, JsonSerializationContext jsonSerializationContext);
}

View File

@@ -0,0 +1,75 @@
package com.google.gson;
import com.google.gson.internal.Streams;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.MalformedJsonException;
import java.io.EOFException;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.util.Iterator;
import java.util.NoSuchElementException;
/* loaded from: classes3.dex */
public final class JsonStreamParser implements Iterator<JsonElement> {
private final Object lock;
private final JsonReader parser;
public JsonStreamParser(String str) {
this(new StringReader(str));
}
public JsonStreamParser(Reader reader) {
JsonReader jsonReader = new JsonReader(reader);
this.parser = jsonReader;
jsonReader.setLenient(true);
this.lock = new Object();
}
/* JADX WARN: Can't rename method to resolve collision */
@Override // java.util.Iterator
public JsonElement next() throws JsonParseException {
if (!hasNext()) {
throw new NoSuchElementException();
}
try {
return Streams.parse(this.parser);
} catch (JsonParseException e) {
if (e.getCause() instanceof EOFException) {
throw new NoSuchElementException();
}
throw e;
} catch (OutOfMemoryError e2) {
throw new JsonParseException("Failed parsing JSON source to Json", e2);
} catch (StackOverflowError e3) {
throw new JsonParseException("Failed parsing JSON source to Json", e3);
}
}
@Override // java.util.Iterator
public boolean hasNext() {
boolean z;
synchronized (this.lock) {
try {
try {
try {
z = this.parser.peek() != JsonToken.END_DOCUMENT;
} catch (IOException e) {
throw new JsonIOException(e);
}
} catch (MalformedJsonException e2) {
throw new JsonSyntaxException(e2);
}
} catch (Throwable th) {
throw th;
}
}
return z;
}
@Override // java.util.Iterator
public void remove() {
throw new UnsupportedOperationException();
}
}

View File

@@ -0,0 +1,18 @@
package com.google.gson;
/* loaded from: classes3.dex */
public final class JsonSyntaxException extends JsonParseException {
private static final long serialVersionUID = 1;
public JsonSyntaxException(String str) {
super(str);
}
public JsonSyntaxException(String str, Throwable th) {
super(str, th);
}
public JsonSyntaxException(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,25 @@
package com.google.gson;
/* loaded from: classes3.dex */
public enum LongSerializationPolicy {
DEFAULT { // from class: com.google.gson.LongSerializationPolicy.1
@Override // com.google.gson.LongSerializationPolicy
public JsonElement serialize(Long l) {
if (l == null) {
return JsonNull.INSTANCE;
}
return new JsonPrimitive(l);
}
},
STRING { // from class: com.google.gson.LongSerializationPolicy.2
@Override // com.google.gson.LongSerializationPolicy
public JsonElement serialize(Long l) {
if (l == null) {
return JsonNull.INSTANCE;
}
return new JsonPrimitive(l.toString());
}
};
public abstract JsonElement serialize(Long l);
}

View File

@@ -0,0 +1,58 @@
package com.google.gson;
import com.google.gson.internal.LazilyParsedNumber;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.MalformedJsonException;
import java.io.IOException;
import java.math.BigDecimal;
/* loaded from: classes3.dex */
public enum ToNumberPolicy implements ToNumberStrategy {
DOUBLE { // from class: com.google.gson.ToNumberPolicy.1
@Override // com.google.gson.ToNumberStrategy
public Double readNumber(JsonReader jsonReader) throws IOException {
return Double.valueOf(jsonReader.nextDouble());
}
},
LAZILY_PARSED_NUMBER { // from class: com.google.gson.ToNumberPolicy.2
@Override // com.google.gson.ToNumberStrategy
public Number readNumber(JsonReader jsonReader) throws IOException {
return new LazilyParsedNumber(jsonReader.nextString());
}
},
LONG_OR_DOUBLE { // from class: com.google.gson.ToNumberPolicy.3
@Override // com.google.gson.ToNumberStrategy
public Number readNumber(JsonReader jsonReader) throws IOException, JsonParseException {
String nextString = jsonReader.nextString();
try {
try {
return Long.valueOf(Long.parseLong(nextString));
} catch (NumberFormatException unused) {
Double valueOf = Double.valueOf(nextString);
if (!valueOf.isInfinite()) {
if (valueOf.isNaN()) {
}
return valueOf;
}
if (!jsonReader.isLenient()) {
throw new MalformedJsonException("JSON forbids NaN and infinities: " + valueOf + "; at path " + jsonReader.getPath());
}
return valueOf;
}
} catch (NumberFormatException e) {
throw new JsonParseException("Cannot parse " + nextString + "; at path " + jsonReader.getPath(), e);
}
}
},
BIG_DECIMAL { // from class: com.google.gson.ToNumberPolicy.4
@Override // com.google.gson.ToNumberStrategy
public BigDecimal readNumber(JsonReader jsonReader) throws IOException {
String nextString = jsonReader.nextString();
try {
return new BigDecimal(nextString);
} catch (NumberFormatException e) {
throw new JsonParseException("Cannot parse " + nextString + "; at path " + jsonReader.getPath(), e);
}
}
}
}

View File

@@ -0,0 +1,9 @@
package com.google.gson;
import com.google.gson.stream.JsonReader;
import java.io.IOException;
/* loaded from: classes3.dex */
public interface ToNumberStrategy {
Number readNumber(JsonReader jsonReader) throws IOException;
}

View File

@@ -0,0 +1,83 @@
package com.google.gson;
import com.google.gson.internal.bind.JsonTreeReader;
import com.google.gson.internal.bind.JsonTreeWriter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
/* loaded from: classes3.dex */
public abstract class TypeAdapter<T> {
/* renamed from: read */
public abstract T read2(JsonReader jsonReader) throws IOException;
public abstract void write(JsonWriter jsonWriter, T t) throws IOException;
public final void toJson(Writer writer, T t) throws IOException {
write(new JsonWriter(writer), t);
}
public final TypeAdapter<T> nullSafe() {
return new TypeAdapter<T>() { // from class: com.google.gson.TypeAdapter.1
@Override // com.google.gson.TypeAdapter
public void write(JsonWriter jsonWriter, T t) throws IOException {
if (t == null) {
jsonWriter.nullValue();
} else {
TypeAdapter.this.write(jsonWriter, t);
}
}
@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 (T) TypeAdapter.this.read2(jsonReader);
}
};
}
public final String toJson(T t) {
StringWriter stringWriter = new StringWriter();
try {
toJson(stringWriter, t);
return stringWriter.toString();
} catch (IOException e) {
throw new AssertionError(e);
}
}
public final JsonElement toJsonTree(T t) {
try {
JsonTreeWriter jsonTreeWriter = new JsonTreeWriter();
write(jsonTreeWriter, t);
return jsonTreeWriter.get();
} catch (IOException e) {
throw new JsonIOException(e);
}
}
public final T fromJson(Reader reader) throws IOException {
return read2(new JsonReader(reader));
}
public final T fromJson(String str) throws IOException {
return fromJson(new StringReader(str));
}
public final T fromJsonTree(JsonElement jsonElement) {
try {
return read2(new JsonTreeReader(jsonElement));
} catch (IOException e) {
throw new JsonIOException(e);
}
}
}

View File

@@ -0,0 +1,8 @@
package com.google.gson;
import com.google.gson.reflect.TypeToken;
/* loaded from: classes3.dex */
public interface TypeAdapterFactory {
<T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken);
}

View File

@@ -0,0 +1,17 @@
package com.google.gson.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.FIELD})
@Documented
@Retention(RetentionPolicy.RUNTIME)
/* loaded from: classes3.dex */
public @interface Expose {
boolean deserialize() default true;
boolean serialize() default true;
}

View File

@@ -0,0 +1,15 @@
package com.google.gson.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.TYPE, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
/* loaded from: classes3.dex */
public @interface JsonAdapter {
boolean nullSafe() default true;
Class<?> value();
}

View File

@@ -0,0 +1,17 @@
package com.google.gson.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.FIELD, ElementType.METHOD})
@Documented
@Retention(RetentionPolicy.RUNTIME)
/* loaded from: classes3.dex */
public @interface SerializedName {
String[] alternate() default {};
String value();
}

View File

@@ -0,0 +1,15 @@
package com.google.gson.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.FIELD, ElementType.TYPE})
@Documented
@Retention(RetentionPolicy.RUNTIME)
/* loaded from: classes3.dex */
public @interface Since {
double value();
}

View File

@@ -0,0 +1,15 @@
package com.google.gson.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.FIELD, ElementType.TYPE})
@Documented
@Retention(RetentionPolicy.RUNTIME)
/* loaded from: classes3.dex */
public @interface Until {
double value();
}

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() {
}
}

View File

@@ -0,0 +1,193 @@
package com.google.gson.reflect;
import com.google.gson.internal.C$Gson$Preconditions;
import com.google.gson.internal.C$Gson$Types;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes3.dex */
public class TypeToken<T> {
final int hashCode;
final Class<? super T> rawType;
final Type type;
public final Class<? super T> getRawType() {
return this.rawType;
}
public final Type getType() {
return this.type;
}
public final int hashCode() {
return this.hashCode;
}
public TypeToken() {
Type superclassTypeParameter = getSuperclassTypeParameter(getClass());
this.type = superclassTypeParameter;
this.rawType = (Class<? super T>) C$Gson$Types.getRawType(superclassTypeParameter);
this.hashCode = superclassTypeParameter.hashCode();
}
public TypeToken(Type type) {
Type canonicalize = C$Gson$Types.canonicalize((Type) C$Gson$Preconditions.checkNotNull(type));
this.type = canonicalize;
this.rawType = (Class<? super T>) C$Gson$Types.getRawType(canonicalize);
this.hashCode = canonicalize.hashCode();
}
public static Type getSuperclassTypeParameter(Class<?> cls) {
Type genericSuperclass = cls.getGenericSuperclass();
if (genericSuperclass instanceof Class) {
throw new RuntimeException("Missing type parameter.");
}
return C$Gson$Types.canonicalize(((ParameterizedType) genericSuperclass).getActualTypeArguments()[0]);
}
@Deprecated
public boolean isAssignableFrom(Class<?> cls) {
return isAssignableFrom((Type) cls);
}
@Deprecated
public boolean isAssignableFrom(Type type) {
if (type == null) {
return false;
}
if (this.type.equals(type)) {
return true;
}
Type type2 = this.type;
if (type2 instanceof Class) {
return this.rawType.isAssignableFrom(C$Gson$Types.getRawType(type));
}
if (type2 instanceof ParameterizedType) {
return isAssignableFrom(type, (ParameterizedType) type2, new HashMap());
}
if (type2 instanceof GenericArrayType) {
return this.rawType.isAssignableFrom(C$Gson$Types.getRawType(type)) && isAssignableFrom(type, (GenericArrayType) this.type);
}
throw buildUnexpectedTypeError(type2, Class.class, ParameterizedType.class, GenericArrayType.class);
}
@Deprecated
public boolean isAssignableFrom(TypeToken<?> typeToken) {
return isAssignableFrom(typeToken.getType());
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v0, types: [java.lang.reflect.Type] */
/* JADX WARN: Type inference failed for: r1v10 */
/* JADX WARN: Type inference failed for: r1v3, types: [java.lang.Class] */
/* JADX WARN: Type inference failed for: r1v5, types: [java.lang.reflect.Type] */
/* JADX WARN: Type inference failed for: r1v8, types: [java.lang.reflect.Type] */
/* JADX WARN: Type inference failed for: r1v9 */
private static boolean isAssignableFrom(Type type, GenericArrayType genericArrayType) {
Type genericComponentType = genericArrayType.getGenericComponentType();
if (!(genericComponentType instanceof ParameterizedType)) {
return true;
}
if (type instanceof GenericArrayType) {
type = ((GenericArrayType) type).getGenericComponentType();
} else if (type instanceof Class) {
type = (Class) type;
while (type.isArray()) {
type = type.getComponentType();
}
}
return isAssignableFrom(type, (ParameterizedType) genericComponentType, new HashMap());
}
private static boolean isAssignableFrom(Type type, ParameterizedType parameterizedType, Map<String, Type> map) {
if (type == null) {
return false;
}
if (parameterizedType.equals(type)) {
return true;
}
Class<?> rawType = C$Gson$Types.getRawType(type);
ParameterizedType parameterizedType2 = type instanceof ParameterizedType ? (ParameterizedType) type : null;
if (parameterizedType2 != null) {
Type[] actualTypeArguments = parameterizedType2.getActualTypeArguments();
TypeVariable<Class<?>>[] typeParameters = rawType.getTypeParameters();
for (int i = 0; i < actualTypeArguments.length; i++) {
Type type2 = actualTypeArguments[i];
TypeVariable<Class<?>> typeVariable = typeParameters[i];
while (type2 instanceof TypeVariable) {
type2 = map.get(((TypeVariable) type2).getName());
}
map.put(typeVariable.getName(), type2);
}
if (typeEquals(parameterizedType2, parameterizedType, map)) {
return true;
}
}
for (Type type3 : rawType.getGenericInterfaces()) {
if (isAssignableFrom(type3, parameterizedType, new HashMap(map))) {
return true;
}
}
return isAssignableFrom(rawType.getGenericSuperclass(), parameterizedType, new HashMap(map));
}
private static boolean typeEquals(ParameterizedType parameterizedType, ParameterizedType parameterizedType2, Map<String, Type> map) {
if (!parameterizedType.getRawType().equals(parameterizedType2.getRawType())) {
return false;
}
Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
Type[] actualTypeArguments2 = parameterizedType2.getActualTypeArguments();
for (int i = 0; i < actualTypeArguments.length; i++) {
if (!matches(actualTypeArguments[i], actualTypeArguments2[i], map)) {
return false;
}
}
return true;
}
private static AssertionError buildUnexpectedTypeError(Type type, Class<?>... clsArr) {
StringBuilder sb = new StringBuilder("Unexpected type. Expected one of: ");
for (Class<?> cls : clsArr) {
sb.append(cls.getName());
sb.append(", ");
}
sb.append("but got: ");
sb.append(type.getClass().getName());
sb.append(", for type token: ");
sb.append(type.toString());
sb.append('.');
return new AssertionError(sb.toString());
}
private static boolean matches(Type type, Type type2, Map<String, Type> map) {
return type2.equals(type) || ((type instanceof TypeVariable) && type2.equals(map.get(((TypeVariable) type).getName())));
}
public final boolean equals(Object obj) {
return (obj instanceof TypeToken) && C$Gson$Types.equals(this.type, ((TypeToken) obj).type);
}
public final String toString() {
return C$Gson$Types.typeToString(this.type);
}
public static TypeToken<?> get(Type type) {
return new TypeToken<>(type);
}
public static <T> TypeToken<T> get(Class<T> cls) {
return new TypeToken<>(cls);
}
public static TypeToken<?> getParameterized(Type type, Type... typeArr) {
return new TypeToken<>(C$Gson$Types.newParameterizedTypeWithOwner(null, type, typeArr));
}
public static TypeToken<?> getArray(Type type) {
return new TypeToken<>(C$Gson$Types.arrayOf(type));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
package com.google.gson.stream;
/* loaded from: classes3.dex */
final class JsonScope {
static final int CLOSED = 8;
static final int DANGLING_NAME = 4;
static final int EMPTY_ARRAY = 1;
static final int EMPTY_DOCUMENT = 6;
static final int EMPTY_OBJECT = 3;
static final int NONEMPTY_ARRAY = 2;
static final int NONEMPTY_DOCUMENT = 7;
static final int NONEMPTY_OBJECT = 5;
}

View File

@@ -0,0 +1,15 @@
package com.google.gson.stream;
/* loaded from: classes3.dex */
public enum JsonToken {
BEGIN_ARRAY,
END_ARRAY,
BEGIN_OBJECT,
END_OBJECT,
NAME,
STRING,
NUMBER,
BOOLEAN,
NULL,
END_DOCUMENT
}

View File

@@ -0,0 +1,386 @@
package com.google.gson.stream;
import com.facebook.internal.security.CertificateUtil;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
import java.io.Writer;
import java.util.Arrays;
/* loaded from: classes3.dex */
public class JsonWriter implements Closeable, Flushable {
private static final String[] HTML_SAFE_REPLACEMENT_CHARS;
private static final String[] REPLACEMENT_CHARS = new String[128];
private String deferredName;
private boolean htmlSafe;
private String indent;
private boolean lenient;
private final Writer out;
private String separator;
private boolean serializeNulls;
private int[] stack = new int[32];
private int stackSize = 0;
public final boolean getSerializeNulls() {
return this.serializeNulls;
}
public final boolean isHtmlSafe() {
return this.htmlSafe;
}
public boolean isLenient() {
return this.lenient;
}
public final void setHtmlSafe(boolean z) {
this.htmlSafe = z;
}
public final void setLenient(boolean z) {
this.lenient = z;
}
public final void setSerializeNulls(boolean z) {
this.serializeNulls = z;
}
static {
for (int i = 0; i <= 31; i++) {
REPLACEMENT_CHARS[i] = String.format("\\u%04x", Integer.valueOf(i));
}
String[] strArr = REPLACEMENT_CHARS;
strArr[34] = "\\\"";
strArr[92] = "\\\\";
strArr[9] = "\\t";
strArr[8] = "\\b";
strArr[10] = "\\n";
strArr[13] = "\\r";
strArr[12] = "\\f";
String[] strArr2 = (String[]) strArr.clone();
HTML_SAFE_REPLACEMENT_CHARS = strArr2;
strArr2[60] = "\\u003c";
strArr2[62] = "\\u003e";
strArr2[38] = "\\u0026";
strArr2[61] = "\\u003d";
strArr2[39] = "\\u0027";
}
public JsonWriter(Writer writer) {
push(6);
this.separator = CertificateUtil.DELIMITER;
this.serializeNulls = true;
if (writer == null) {
throw new NullPointerException("out == null");
}
this.out = writer;
}
public final void setIndent(String str) {
if (str.length() == 0) {
this.indent = null;
this.separator = CertificateUtil.DELIMITER;
} else {
this.indent = str;
this.separator = ": ";
}
}
public JsonWriter beginArray() throws IOException {
writeDeferredName();
return open(1, '[');
}
public JsonWriter endArray() throws IOException {
return close(1, 2, ']');
}
public JsonWriter beginObject() throws IOException {
writeDeferredName();
return open(3, '{');
}
public JsonWriter endObject() throws IOException {
return close(3, 5, '}');
}
private JsonWriter open(int i, char c) throws IOException {
beforeValue();
push(i);
this.out.write(c);
return this;
}
private JsonWriter close(int i, int i2, char c) throws IOException {
int peek = peek();
if (peek != i2 && peek != i) {
throw new IllegalStateException("Nesting problem.");
}
if (this.deferredName != null) {
throw new IllegalStateException("Dangling name: " + this.deferredName);
}
this.stackSize--;
if (peek == i2) {
newline();
}
this.out.write(c);
return this;
}
private void push(int i) {
int i2 = this.stackSize;
int[] iArr = this.stack;
if (i2 == iArr.length) {
this.stack = Arrays.copyOf(iArr, i2 * 2);
}
int[] iArr2 = this.stack;
int i3 = this.stackSize;
this.stackSize = i3 + 1;
iArr2[i3] = i;
}
private int peek() {
int i = this.stackSize;
if (i == 0) {
throw new IllegalStateException("JsonWriter is closed.");
}
return this.stack[i - 1];
}
private void replaceTop(int i) {
this.stack[this.stackSize - 1] = i;
}
public JsonWriter name(String str) throws IOException {
if (str == null) {
throw new NullPointerException("name == null");
}
if (this.deferredName != null) {
throw new IllegalStateException();
}
if (this.stackSize == 0) {
throw new IllegalStateException("JsonWriter is closed.");
}
this.deferredName = str;
return this;
}
private void writeDeferredName() throws IOException {
if (this.deferredName != null) {
beforeName();
string(this.deferredName);
this.deferredName = null;
}
}
public JsonWriter value(String str) throws IOException {
if (str == null) {
return nullValue();
}
writeDeferredName();
beforeValue();
string(str);
return this;
}
public JsonWriter jsonValue(String str) throws IOException {
if (str == null) {
return nullValue();
}
writeDeferredName();
beforeValue();
this.out.append((CharSequence) str);
return this;
}
public JsonWriter nullValue() throws IOException {
if (this.deferredName != null) {
if (!this.serializeNulls) {
this.deferredName = null;
return this;
}
writeDeferredName();
}
beforeValue();
this.out.write("null");
return this;
}
public JsonWriter value(boolean z) throws IOException {
writeDeferredName();
beforeValue();
this.out.write(z ? "true" : "false");
return this;
}
public JsonWriter value(Boolean bool) throws IOException {
if (bool == null) {
return nullValue();
}
writeDeferredName();
beforeValue();
this.out.write(bool.booleanValue() ? "true" : "false");
return this;
}
public JsonWriter value(double d) throws IOException {
writeDeferredName();
if (!this.lenient && (Double.isNaN(d) || Double.isInfinite(d))) {
throw new IllegalArgumentException("Numeric values must be finite, but was " + d);
}
beforeValue();
this.out.append((CharSequence) Double.toString(d));
return this;
}
public JsonWriter value(long j) throws IOException {
writeDeferredName();
beforeValue();
this.out.write(Long.toString(j));
return this;
}
public JsonWriter value(Number number) throws IOException {
if (number == null) {
return nullValue();
}
writeDeferredName();
String obj = number.toString();
if (!this.lenient && (obj.equals("-Infinity") || obj.equals("Infinity") || obj.equals("NaN"))) {
throw new IllegalArgumentException("Numeric values must be finite, but was " + number);
}
beforeValue();
this.out.append((CharSequence) obj);
return this;
}
public void flush() throws IOException {
if (this.stackSize == 0) {
throw new IllegalStateException("JsonWriter is closed.");
}
this.out.flush();
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
this.out.close();
int i = this.stackSize;
if (i > 1 || (i == 1 && this.stack[i - 1] != 7)) {
throw new IOException("Incomplete document");
}
this.stackSize = 0;
}
/* JADX WARN: Removed duplicated region for block: B:11:0x0034 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void string(java.lang.String r9) throws java.io.IOException {
/*
r8 = this;
boolean r0 = r8.htmlSafe
if (r0 == 0) goto L7
java.lang.String[] r0 = com.google.gson.stream.JsonWriter.HTML_SAFE_REPLACEMENT_CHARS
goto L9
L7:
java.lang.String[] r0 = com.google.gson.stream.JsonWriter.REPLACEMENT_CHARS
L9:
java.io.Writer r1 = r8.out
r2 = 34
r1.write(r2)
int r1 = r9.length()
r3 = 0
r4 = r3
L16:
if (r3 >= r1) goto L45
char r5 = r9.charAt(r3)
r6 = 128(0x80, float:1.8E-43)
if (r5 >= r6) goto L25
r5 = r0[r5]
if (r5 != 0) goto L32
goto L42
L25:
r6 = 8232(0x2028, float:1.1535E-41)
if (r5 != r6) goto L2c
java.lang.String r5 = "\\u2028"
goto L32
L2c:
r6 = 8233(0x2029, float:1.1537E-41)
if (r5 != r6) goto L42
java.lang.String r5 = "\\u2029"
L32:
if (r4 >= r3) goto L3b
java.io.Writer r6 = r8.out
int r7 = r3 - r4
r6.write(r9, r4, r7)
L3b:
java.io.Writer r4 = r8.out
r4.write(r5)
int r4 = r3 + 1
L42:
int r3 = r3 + 1
goto L16
L45:
if (r4 >= r1) goto L4d
java.io.Writer r0 = r8.out
int r1 = r1 - r4
r0.write(r9, r4, r1)
L4d:
java.io.Writer r9 = r8.out
r9.write(r2)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.gson.stream.JsonWriter.string(java.lang.String):void");
}
private void newline() throws IOException {
if (this.indent == null) {
return;
}
this.out.write(10);
int i = this.stackSize;
for (int i2 = 1; i2 < i; i2++) {
this.out.write(this.indent);
}
}
private void beforeName() throws IOException {
int peek = peek();
if (peek == 5) {
this.out.write(44);
} else if (peek != 3) {
throw new IllegalStateException("Nesting problem.");
}
newline();
replaceTop(4);
}
private void beforeValue() throws IOException {
int peek = peek();
if (peek == 1) {
replaceTop(2);
newline();
return;
}
if (peek == 2) {
this.out.append(',');
newline();
} else {
if (peek != 4) {
if (peek != 6) {
if (peek != 7) {
throw new IllegalStateException("Nesting problem.");
}
if (!this.lenient) {
throw new IllegalStateException("JSON must have only one top-level value.");
}
}
replaceTop(7);
return;
}
this.out.append((CharSequence) this.separator);
replaceTop(5);
}
}
}

View File

@@ -0,0 +1,21 @@
package com.google.gson.stream;
import java.io.IOException;
/* loaded from: classes3.dex */
public final class MalformedJsonException extends IOException {
private static final long serialVersionUID = 1;
public MalformedJsonException(String str) {
super(str);
}
public MalformedJsonException(String str, Throwable th) {
super(str);
initCause(th);
}
public MalformedJsonException(Throwable th) {
initCause(th);
}
}