2021-06-27 20:44:35 +00:00
package com.google.gson ;
import c.i.d.c ;
import c.i.d.d ;
import c.i.d.f ;
import c.i.d.j ;
import c.i.d.n ;
import c.i.d.o ;
import c.i.d.q.g ;
import c.i.d.q.x.a ;
import com.google.gson.internal.Excluder ;
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.MapTypeAdapterFactory ;
import com.google.gson.internal.bind.ObjectTypeAdapter ;
import com.google.gson.internal.bind.ReflectiveTypeAdapterFactory ;
import com.google.gson.internal.bind.SqlDateTypeAdapter ;
import com.google.gson.internal.bind.TimeTypeAdapter ;
import com.google.gson.internal.bind.TypeAdapters ;
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.List ;
import java.util.Map ;
import java.util.concurrent.ConcurrentHashMap ;
import java.util.concurrent.atomic.AtomicLong ;
import java.util.concurrent.atomic.AtomicLongArray ;
public final class Gson {
public static final TypeToken < ? > a = TypeToken . get ( Object . class ) ;
public final ThreadLocal < Map < TypeToken < ? > , FutureTypeAdapter < ? > > > b ;
/* renamed from: c reason: collision with root package name */
2021-07-04 15:26:29 +00:00
public final Map < TypeToken < ? > , TypeAdapter < ? > > f2357c ;
2021-06-27 20:44:35 +00:00
public final g d ;
public final JsonAdapterAnnotationTypeAdapterFactory e ;
public final List < o > f ;
public final Map < Type , f < ? > > g ;
public final boolean h ;
public final boolean i ;
public final boolean j ;
public final boolean k ;
public final boolean l ;
public final List < o > m ;
public final List < o > n ;
/* renamed from: com.google.gson.Gson$1 reason: invalid class name */
public class AnonymousClass1 extends TypeAdapter < Number > {
public AnonymousClass1 ( Gson gson ) {
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // com.google.gson.TypeAdapter
public Number read ( JsonReader jsonReader ) throws IOException {
if ( jsonReader . N ( ) ! = JsonToken . NULL ) {
return Double . valueOf ( jsonReader . x ( ) ) ;
}
jsonReader . H ( ) ;
return null ;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [com.google.gson.stream.JsonWriter, java.lang.Object] */
@Override // com.google.gson.TypeAdapter
public void write ( JsonWriter jsonWriter , Number number ) throws IOException {
Number number2 = number ;
if ( number2 = = null ) {
jsonWriter . s ( ) ;
return ;
}
Gson . b ( number2 . doubleValue ( ) ) ;
jsonWriter . G ( number2 ) ;
}
}
/* renamed from: com.google.gson.Gson$2 reason: invalid class name */
public class AnonymousClass2 extends TypeAdapter < Number > {
public AnonymousClass2 ( Gson gson ) {
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // com.google.gson.TypeAdapter
public Number read ( JsonReader jsonReader ) throws IOException {
if ( jsonReader . N ( ) ! = JsonToken . NULL ) {
return Float . valueOf ( ( float ) jsonReader . x ( ) ) ;
}
jsonReader . H ( ) ;
return null ;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [com.google.gson.stream.JsonWriter, java.lang.Object] */
@Override // com.google.gson.TypeAdapter
public void write ( JsonWriter jsonWriter , Number number ) throws IOException {
Number number2 = number ;
if ( number2 = = null ) {
jsonWriter . s ( ) ;
return ;
}
Gson . b ( ( double ) number2 . floatValue ( ) ) ;
jsonWriter . G ( number2 ) ;
}
}
/* renamed from: com.google.gson.Gson$3 reason: invalid class name */
public class AnonymousClass3 extends TypeAdapter < Number > {
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // com.google.gson.TypeAdapter
public Number read ( JsonReader jsonReader ) throws IOException {
if ( jsonReader . N ( ) ! = JsonToken . NULL ) {
return Long . valueOf ( jsonReader . B ( ) ) ;
}
jsonReader . H ( ) ;
return null ;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [com.google.gson.stream.JsonWriter, java.lang.Object] */
@Override // com.google.gson.TypeAdapter
public void write ( JsonWriter jsonWriter , Number number ) throws IOException {
Number number2 = number ;
if ( number2 = = null ) {
jsonWriter . s ( ) ;
} else {
jsonWriter . H ( number2 . toString ( ) ) ;
}
}
}
/* renamed from: com.google.gson.Gson$4 reason: invalid class name */
public class AnonymousClass4 extends TypeAdapter < AtomicLong > {
public final /* synthetic */ TypeAdapter a ;
public AnonymousClass4 ( TypeAdapter typeAdapter ) {
this . a = typeAdapter ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // com.google.gson.TypeAdapter
public AtomicLong read ( JsonReader jsonReader ) throws IOException {
return new AtomicLong ( ( ( Number ) this . a . read ( jsonReader ) ) . longValue ( ) ) ;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [com.google.gson.stream.JsonWriter, java.lang.Object] */
@Override // com.google.gson.TypeAdapter
public void write ( JsonWriter jsonWriter , AtomicLong atomicLong ) throws IOException {
this . a . write ( jsonWriter , Long . valueOf ( atomicLong . get ( ) ) ) ;
}
}
/* renamed from: com.google.gson.Gson$5 reason: invalid class name */
public class AnonymousClass5 extends TypeAdapter < AtomicLongArray > {
public final /* synthetic */ TypeAdapter a ;
public AnonymousClass5 ( TypeAdapter typeAdapter ) {
this . a = typeAdapter ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // com.google.gson.TypeAdapter
public AtomicLongArray read ( JsonReader jsonReader ) throws IOException {
ArrayList arrayList = new ArrayList ( ) ;
jsonReader . a ( ) ;
while ( jsonReader . r ( ) ) {
arrayList . add ( Long . valueOf ( ( ( Number ) this . a . read ( jsonReader ) ) . longValue ( ) ) ) ;
}
jsonReader . e ( ) ;
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 ;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [com.google.gson.stream.JsonWriter, java.lang.Object] */
@Override // com.google.gson.TypeAdapter
public void write ( JsonWriter jsonWriter , AtomicLongArray atomicLongArray ) throws IOException {
AtomicLongArray atomicLongArray2 = atomicLongArray ;
jsonWriter . b ( ) ;
int length = atomicLongArray2 . length ( ) ;
for ( int i = 0 ; i < length ; i + + ) {
this . a . write ( jsonWriter , Long . valueOf ( atomicLongArray2 . get ( i ) ) ) ;
}
jsonWriter . e ( ) ;
}
}
public static class FutureTypeAdapter < T > extends TypeAdapter < T > {
public TypeAdapter < T > a ;
@Override // com.google.gson.TypeAdapter
public T read ( JsonReader jsonReader ) throws IOException {
TypeAdapter < T > typeAdapter = this . a ;
if ( typeAdapter ! = null ) {
return typeAdapter . read ( jsonReader ) ;
}
throw new IllegalStateException ( ) ;
}
@Override // com.google.gson.TypeAdapter
public void write ( JsonWriter jsonWriter , T t ) throws IOException {
TypeAdapter < T > typeAdapter = this . a ;
if ( typeAdapter ! = null ) {
typeAdapter . write ( jsonWriter , t ) ;
return ;
}
throw new IllegalStateException ( ) ;
}
}
public Gson ( ) {
this ( Excluder . i , c . IDENTITY , Collections . emptyMap ( ) , false , false , false , true , false , false , false , n . DEFAULT , null , 2 , 2 , Collections . emptyList ( ) , Collections . emptyList ( ) , Collections . emptyList ( ) ) ;
}
public Gson ( Excluder excluder , d dVar , Map < Type , f < ? > > map , boolean z2 , boolean z3 , boolean z4 , boolean z5 , boolean z6 , boolean z7 , boolean z8 , n nVar , String str , int i , int i2 , List < o > list , List < o > list2 , List < o > list3 ) {
this . b = new ThreadLocal < > ( ) ;
2021-07-04 15:26:29 +00:00
this . f2357c = new ConcurrentHashMap ( ) ;
2021-06-27 20:44:35 +00:00
this . g = map ;
this . d = new g ( map ) ;
this . h = z2 ;
this . i = z4 ;
this . j = z5 ;
this . k = z6 ;
this . l = z7 ;
this . m = list ;
this . n = list2 ;
ArrayList arrayList = new ArrayList ( ) ;
arrayList . add ( TypeAdapters . Y ) ;
arrayList . add ( ObjectTypeAdapter . a ) ;
arrayList . add ( excluder ) ;
arrayList . addAll ( list3 ) ;
arrayList . add ( TypeAdapters . D ) ;
arrayList . add ( TypeAdapters . m ) ;
arrayList . add ( TypeAdapters . g ) ;
arrayList . add ( TypeAdapters . i ) ;
arrayList . add ( TypeAdapters . k ) ;
TypeAdapter r3 = nVar = = n . DEFAULT ? TypeAdapters . t : new AnonymousClass3 ( ) ;
arrayList . add ( new TypeAdapters . AnonymousClass33 ( Long . TYPE , Long . class , r3 ) ) ;
arrayList . add ( new TypeAdapters . AnonymousClass33 ( Double . TYPE , Double . class , z8 ? TypeAdapters . v : new AnonymousClass1 ( this ) ) ) ;
arrayList . add ( new TypeAdapters . AnonymousClass33 ( Float . TYPE , Float . class , z8 ? TypeAdapters . u : new AnonymousClass2 ( this ) ) ) ;
2021-07-04 15:26:29 +00:00
arrayList . add ( TypeAdapters . f2366x ) ;
2021-06-27 20:44:35 +00:00
arrayList . add ( TypeAdapters . o ) ;
arrayList . add ( TypeAdapters . q ) ;
arrayList . add ( new TypeAdapters . AnonymousClass32 ( AtomicLong . class , new AnonymousClass4 ( r3 ) . nullSafe ( ) ) ) ;
arrayList . add ( new TypeAdapters . AnonymousClass32 ( AtomicLongArray . class , new AnonymousClass5 ( r3 ) . nullSafe ( ) ) ) ;
2021-07-04 15:26:29 +00:00
arrayList . add ( TypeAdapters . f2365s ) ;
arrayList . add ( TypeAdapters . f2368z ) ;
2021-06-27 20:44:35 +00:00
arrayList . add ( TypeAdapters . F ) ;
arrayList . add ( TypeAdapters . H ) ;
arrayList . add ( new TypeAdapters . AnonymousClass32 ( BigDecimal . class , TypeAdapters . B ) ) ;
arrayList . add ( new TypeAdapters . AnonymousClass32 ( BigInteger . class , TypeAdapters . C ) ) ;
arrayList . add ( TypeAdapters . J ) ;
arrayList . add ( TypeAdapters . L ) ;
arrayList . add ( TypeAdapters . P ) ;
arrayList . add ( TypeAdapters . R ) ;
arrayList . add ( TypeAdapters . W ) ;
arrayList . add ( TypeAdapters . N ) ;
arrayList . add ( TypeAdapters . d ) ;
arrayList . add ( DateTypeAdapter . a ) ;
arrayList . add ( TypeAdapters . U ) ;
arrayList . add ( TimeTypeAdapter . a ) ;
arrayList . add ( SqlDateTypeAdapter . a ) ;
arrayList . add ( TypeAdapters . S ) ;
arrayList . add ( ArrayTypeAdapter . a ) ;
arrayList . add ( TypeAdapters . b ) ;
arrayList . add ( new CollectionTypeAdapterFactory ( this . d ) ) ;
arrayList . add ( new MapTypeAdapterFactory ( this . d , z3 ) ) ;
JsonAdapterAnnotationTypeAdapterFactory jsonAdapterAnnotationTypeAdapterFactory = new JsonAdapterAnnotationTypeAdapterFactory ( this . d ) ;
this . e = jsonAdapterAnnotationTypeAdapterFactory ;
arrayList . add ( jsonAdapterAnnotationTypeAdapterFactory ) ;
arrayList . add ( TypeAdapters . Z ) ;
arrayList . add ( new ReflectiveTypeAdapterFactory ( this . d , dVar , excluder , jsonAdapterAnnotationTypeAdapterFactory ) ) ;
this . f = Collections . unmodifiableList ( arrayList ) ;
}
public static void a ( Object obj , JsonReader jsonReader ) {
if ( obj ! = null ) {
try {
if ( jsonReader . N ( ) ! = JsonToken . END_DOCUMENT ) {
throw new JsonIOException ( " JSON document was not fully consumed. " ) ;
}
} catch ( MalformedJsonException e ) {
throw new JsonSyntaxException ( e ) ;
} catch ( IOException e2 ) {
throw new JsonIOException ( e2 ) ;
}
}
}
public static void b ( 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. " ) ;
}
}
public < T > T c ( JsonElement jsonElement , Class < T > cls ) throws JsonSyntaxException {
return ( T ) c . i . a . f . e . o . c . q0 ( cls ) . cast ( jsonElement = = null ? null : d ( new a ( jsonElement ) , cls ) ) ;
}
public < T > T d ( JsonReader jsonReader , Type type ) throws JsonIOException , JsonSyntaxException {
boolean z2 = jsonReader . k ;
boolean z3 = true ;
jsonReader . k = true ;
try {
jsonReader . N ( ) ;
z3 = false ;
T read = h ( TypeToken . get ( type ) ) . read ( jsonReader ) ;
jsonReader . k = z2 ;
return read ;
} catch ( EOFException e ) {
if ( z3 ) {
jsonReader . k = z2 ;
return null ;
}
throw new JsonSyntaxException ( e ) ;
} 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.6): " + e4 . getMessage ( ) ) ;
assertionError . initCause ( e4 ) ;
throw assertionError ;
} catch ( Throwable th ) {
jsonReader . k = z2 ;
throw th ;
}
}
public < T > T e ( Reader reader , Class < T > cls ) throws JsonSyntaxException , JsonIOException {
JsonReader k = k ( reader ) ;
Object d = d ( k , cls ) ;
a ( d , k ) ;
return ( T ) c . i . a . f . e . o . c . q0 ( cls ) . cast ( d ) ;
}
public < T > T f ( String str , Class < T > cls ) throws JsonSyntaxException {
return ( T ) c . i . a . f . e . o . c . q0 ( cls ) . cast ( g ( str , cls ) ) ;
}
public < T > T g ( String str , Type type ) throws JsonSyntaxException {
if ( str = = null ) {
return null ;
}
JsonReader k = k ( new StringReader ( str ) ) ;
T t = ( T ) d ( k , type ) ;
a ( t , k ) ;
return t ;
}
public < T > TypeAdapter < T > h ( TypeToken < T > typeToken ) {
2021-07-04 15:26:29 +00:00
TypeAdapter < T > typeAdapter = ( TypeAdapter < T > ) this . f2357c . get ( typeToken = = null ? a : typeToken ) ;
2021-06-27 20:44:35 +00:00
if ( typeAdapter ! = null ) {
return typeAdapter ;
}
Map < TypeToken < ? > , FutureTypeAdapter < ? > > map = this . b . get ( ) ;
boolean z2 = false ;
if ( map = = null ) {
map = new HashMap < > ( ) ;
this . b . set ( map ) ;
z2 = true ;
}
FutureTypeAdapter < ? > futureTypeAdapter = map . get ( typeToken ) ;
if ( futureTypeAdapter ! = null ) {
return futureTypeAdapter ;
}
try {
FutureTypeAdapter < ? > futureTypeAdapter2 = new FutureTypeAdapter < > ( ) ;
map . put ( typeToken , futureTypeAdapter2 ) ;
for ( o oVar : this . f ) {
TypeAdapter < T > create = oVar . create ( this , typeToken ) ;
if ( create ! = null ) {
if ( futureTypeAdapter2 . a = = null ) {
futureTypeAdapter2 . a = create ;
2021-07-04 15:26:29 +00:00
this . f2357c . put ( typeToken , create ) ;
2021-06-27 20:44:35 +00:00
return create ;
}
throw new AssertionError ( ) ;
}
}
throw new IllegalArgumentException ( " GSON (2.8.6) cannot handle " + typeToken ) ;
} finally {
map . remove ( typeToken ) ;
if ( z2 ) {
this . b . remove ( ) ;
}
}
}
public < T > TypeAdapter < T > i ( Class < T > cls ) {
return h ( TypeToken . get ( ( Class ) cls ) ) ;
}
public < T > TypeAdapter < T > j ( o oVar , TypeToken < T > typeToken ) {
if ( ! this . f . contains ( oVar ) ) {
oVar = this . e ;
}
boolean z2 = false ;
for ( o oVar2 : this . f ) {
if ( z2 ) {
TypeAdapter < T > create = oVar2 . create ( this , typeToken ) ;
if ( create ! = null ) {
return create ;
}
} else if ( oVar2 = = oVar ) {
z2 = true ;
}
}
throw new IllegalArgumentException ( " GSON cannot serialize " + typeToken ) ;
}
public JsonReader k ( Reader reader ) {
JsonReader jsonReader = new JsonReader ( reader ) ;
jsonReader . k = this . l ;
return jsonReader ;
}
public JsonWriter l ( Writer writer ) throws IOException {
if ( this . i ) {
writer . write ( " )]}' \ n " ) ;
}
JsonWriter jsonWriter = new JsonWriter ( writer ) ;
if ( this . k ) {
jsonWriter . n = " " ;
jsonWriter . o = " : " ;
}
2021-07-04 15:26:29 +00:00
jsonWriter . f2372s = this . h ;
2021-06-27 20:44:35 +00:00
return jsonWriter ;
}
public String m ( Object obj ) {
if ( obj = = null ) {
JsonElement jsonElement = j . a ;
StringWriter stringWriter = new StringWriter ( ) ;
try {
n ( jsonElement , l ( stringWriter ) ) ;
return stringWriter . toString ( ) ;
} catch ( IOException e ) {
throw new JsonIOException ( e ) ;
}
} else {
Type type = obj . getClass ( ) ;
StringWriter stringWriter2 = new StringWriter ( ) ;
try {
o ( obj , type , l ( stringWriter2 ) ) ;
return stringWriter2 . toString ( ) ;
} catch ( IOException e2 ) {
throw new JsonIOException ( e2 ) ;
}
}
}
public void n ( JsonElement jsonElement , JsonWriter jsonWriter ) throws JsonIOException {
boolean z2 = jsonWriter . p ;
jsonWriter . p = true ;
boolean z3 = jsonWriter . q ;
jsonWriter . q = this . j ;
2021-07-04 15:26:29 +00:00
boolean z4 = jsonWriter . f2372s ;
jsonWriter . f2372s = this . h ;
2021-06-27 20:44:35 +00:00
try {
TypeAdapters . X . write ( jsonWriter , jsonElement ) ;
jsonWriter . p = z2 ;
jsonWriter . q = z3 ;
2021-07-04 15:26:29 +00:00
jsonWriter . f2372s = z4 ;
2021-06-27 20:44:35 +00:00
} catch ( IOException e ) {
throw new JsonIOException ( e ) ;
} catch ( AssertionError e2 ) {
AssertionError assertionError = new AssertionError ( " AssertionError (GSON 2.8.6): " + e2 . getMessage ( ) ) ;
assertionError . initCause ( e2 ) ;
throw assertionError ;
} catch ( Throwable th ) {
jsonWriter . p = z2 ;
jsonWriter . q = z3 ;
2021-07-04 15:26:29 +00:00
jsonWriter . f2372s = z4 ;
2021-06-27 20:44:35 +00:00
throw th ;
}
}
public void o ( Object obj , Type type , JsonWriter jsonWriter ) throws JsonIOException {
TypeAdapter h = h ( TypeToken . get ( type ) ) ;
boolean z2 = jsonWriter . p ;
jsonWriter . p = true ;
boolean z3 = jsonWriter . q ;
jsonWriter . q = this . j ;
2021-07-04 15:26:29 +00:00
boolean z4 = jsonWriter . f2372s ;
jsonWriter . f2372s = this . h ;
2021-06-27 20:44:35 +00:00
try {
h . write ( jsonWriter , obj ) ;
jsonWriter . p = z2 ;
jsonWriter . q = z3 ;
2021-07-04 15:26:29 +00:00
jsonWriter . f2372s = z4 ;
2021-06-27 20:44:35 +00:00
} catch ( IOException e ) {
throw new JsonIOException ( e ) ;
} catch ( AssertionError e2 ) {
AssertionError assertionError = new AssertionError ( " AssertionError (GSON 2.8.6): " + e2 . getMessage ( ) ) ;
assertionError . initCause ( e2 ) ;
throw assertionError ;
} catch ( Throwable th ) {
jsonWriter . p = z2 ;
jsonWriter . q = z3 ;
2021-07-04 15:26:29 +00:00
jsonWriter . f2372s = z4 ;
2021-06-27 20:44:35 +00:00
throw th ;
}
}
public String toString ( ) {
return " {serializeNulls: " + this . h + " ,factories: " + this . f + " ,instanceCreators: " + this . d + " } " ;
}
}