2021-10-19 23:48:27 +00:00
package h0 ;
2021-06-27 20:44:35 +00:00
2021-10-19 23:48:27 +00:00
import c0.z.d.m ;
import e0.b0 ;
import f0.e ;
2021-08-04 22:02:59 +00:00
import java.io.IOException ;
2021-06-27 20:44:35 +00:00
import java.lang.annotation.Annotation ;
2021-08-04 22:02:59 +00:00
import java.lang.reflect.Array ;
import java.lang.reflect.GenericArrayType ;
import java.lang.reflect.GenericDeclaration ;
import java.lang.reflect.Method ;
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.NoSuchElementException ;
import java.util.Objects ;
import okhttp3.MediaType ;
import okhttp3.ResponseBody ;
/* compiled from: Utils */
public final class c0 {
public static final Type [ ] a = new Type [ 0 ] ;
2021-06-27 20:44:35 +00:00
2021-08-04 22:02:59 +00:00
/* compiled from: Utils */
public static final class a implements GenericArrayType {
public final Type i ;
public a ( Type type ) {
this . i = type ;
}
@Override // java.lang.Object
public boolean equals ( Object obj ) {
return ( obj instanceof GenericArrayType ) & & c0 . c ( this , ( GenericArrayType ) obj ) ;
}
@Override // java.lang.reflect.GenericArrayType
public Type getGenericComponentType ( ) {
return this . i ;
}
@Override // java.lang.Object
public int hashCode ( ) {
return this . i . hashCode ( ) ;
}
@Override // java.lang.Object
public String toString ( ) {
return c0 . p ( this . i ) + " [] " ;
}
}
/* compiled from: Utils */
public static final class b implements ParameterizedType {
public final Type i ;
public final Type j ;
public final Type [ ] k ;
public b ( Type type , Type type2 , Type . . . typeArr ) {
if ( type2 instanceof Class ) {
if ( ( type = = null ) ! = ( ( ( Class ) type2 ) . getEnclosingClass ( ) ! = null ? false : true ) ) {
throw new IllegalArgumentException ( ) ;
}
}
for ( Type type3 : typeArr ) {
Objects . requireNonNull ( type3 , " typeArgument == null " ) ;
c0 . b ( type3 ) ;
}
this . i = type ;
this . j = type2 ;
this . k = ( Type [ ] ) typeArr . clone ( ) ;
}
@Override // java.lang.Object
public boolean equals ( Object obj ) {
return ( obj instanceof ParameterizedType ) & & c0 . c ( this , ( ParameterizedType ) obj ) ;
}
@Override // java.lang.reflect.ParameterizedType
public Type [ ] getActualTypeArguments ( ) {
return ( Type [ ] ) this . k . clone ( ) ;
}
@Override // java.lang.reflect.ParameterizedType
public Type getOwnerType ( ) {
return this . i ;
}
@Override // java.lang.reflect.ParameterizedType
public Type getRawType ( ) {
return this . j ;
}
@Override // java.lang.Object
public int hashCode ( ) {
int hashCode = Arrays . hashCode ( this . k ) ^ this . j . hashCode ( ) ;
Type type = this . i ;
return hashCode ^ ( type ! = null ? type . hashCode ( ) : 0 ) ;
}
@Override // java.lang.Object
public String toString ( ) {
Type [ ] typeArr = this . k ;
if ( typeArr . length = = 0 ) {
return c0 . p ( this . j ) ;
}
StringBuilder sb = new StringBuilder ( ( typeArr . length + 1 ) * 30 ) ;
sb . append ( c0 . p ( this . j ) ) ;
sb . append ( " < " ) ;
sb . append ( c0 . p ( this . k [ 0 ] ) ) ;
for ( int i = 1 ; i < this . k . length ; i + + ) {
sb . append ( " , " ) ;
sb . append ( c0 . p ( this . k [ i ] ) ) ;
}
sb . append ( " > " ) ;
return sb . toString ( ) ;
}
}
/* compiled from: Utils */
public static final class c implements WildcardType {
public final Type i ;
public final Type j ;
public c ( Type [ ] typeArr , Type [ ] typeArr2 ) {
if ( typeArr2 . length > 1 ) {
throw new IllegalArgumentException ( ) ;
} else if ( typeArr . length ! = 1 ) {
throw new IllegalArgumentException ( ) ;
} else if ( typeArr2 . length = = 1 ) {
Objects . requireNonNull ( typeArr2 [ 0 ] ) ;
c0 . b ( typeArr2 [ 0 ] ) ;
if ( typeArr [ 0 ] = = Object . class ) {
this . j = typeArr2 [ 0 ] ;
this . i = Object . class ;
return ;
}
throw new IllegalArgumentException ( ) ;
} else {
Objects . requireNonNull ( typeArr [ 0 ] ) ;
c0 . b ( typeArr [ 0 ] ) ;
this . j = null ;
this . i = typeArr [ 0 ] ;
}
}
@Override // java.lang.Object
public boolean equals ( Object obj ) {
return ( obj instanceof WildcardType ) & & c0 . c ( this , ( WildcardType ) obj ) ;
}
@Override // java.lang.reflect.WildcardType
public Type [ ] getLowerBounds ( ) {
Type type = this . j ;
return type ! = null ? new Type [ ] { type } : c0 . a ;
}
@Override // java.lang.reflect.WildcardType
public Type [ ] getUpperBounds ( ) {
return new Type [ ] { this . i } ;
}
@Override // java.lang.Object
public int hashCode ( ) {
Type type = this . j ;
return ( type ! = null ? type . hashCode ( ) + 31 : 1 ) ^ ( this . i . hashCode ( ) + 31 ) ;
}
@Override // java.lang.Object
public String toString ( ) {
if ( this . j ! = null ) {
2021-10-14 23:16:01 +00:00
StringBuilder O = c . d . b . a . a . O ( " ? super " ) ;
O . append ( c0 . p ( this . j ) ) ;
return O . toString ( ) ;
2021-08-04 22:02:59 +00:00
} else if ( this . i = = Object . class ) {
return " ? " ;
} else {
2021-10-14 23:16:01 +00:00
StringBuilder O2 = c . d . b . a . a . O ( " ? extends " ) ;
O2 . append ( c0 . p ( this . i ) ) ;
return O2 . toString ( ) ;
2021-08-04 22:02:59 +00:00
}
}
}
public static ResponseBody a ( ResponseBody responseBody ) throws IOException {
e eVar = new e ( ) ;
responseBody . c ( ) . j0 ( eVar ) ;
MediaType b2 = responseBody . b ( ) ;
long a2 = responseBody . a ( ) ;
m . checkParameterIsNotNull ( eVar , " content " ) ;
m . checkParameterIsNotNull ( eVar , " $this$asResponseBody " ) ;
2021-08-24 17:45:16 +00:00
return new b0 ( eVar , b2 , a2 ) ;
2021-08-04 22:02:59 +00:00
}
public static void b ( Type type ) {
if ( ( type instanceof Class ) & & ( ( Class ) type ) . isPrimitive ( ) ) {
throw new IllegalArgumentException ( ) ;
}
}
public static boolean c ( 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 ;
Type ownerType = parameterizedType . getOwnerType ( ) ;
Type ownerType2 = parameterizedType2 . getOwnerType ( ) ;
return ( ownerType = = ownerType2 | | ( ownerType ! = null & & ownerType . equals ( ownerType2 ) ) ) & & parameterizedType . getRawType ( ) . equals ( parameterizedType2 . getRawType ( ) ) & & Arrays . equals ( parameterizedType . getActualTypeArguments ( ) , parameterizedType2 . getActualTypeArguments ( ) ) ;
} else if ( type instanceof GenericArrayType ) {
if ( ! ( type2 instanceof GenericArrayType ) ) {
return false ;
}
return c ( ( ( GenericArrayType ) type ) . getGenericComponentType ( ) , ( ( GenericArrayType ) type2 ) . getGenericComponentType ( ) ) ;
} else 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 ( ) ) ;
} else if ( ! ( type instanceof TypeVariable ) | | ! ( type2 instanceof TypeVariable ) ) {
return false ;
} else {
TypeVariable typeVariable = ( TypeVariable ) type ;
TypeVariable typeVariable2 = ( TypeVariable ) type2 ;
return typeVariable . getGenericDeclaration ( ) = = typeVariable2 . getGenericDeclaration ( ) & & typeVariable . getName ( ) . equals ( typeVariable2 . getName ( ) ) ;
}
}
public static Type d ( 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 + + ) {
if ( interfaces [ i ] = = cls2 ) {
return cls . getGenericInterfaces ( ) [ i ] ;
}
if ( cls2 . isAssignableFrom ( interfaces [ i ] ) ) {
return d ( 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 d ( cls . getGenericSuperclass ( ) , superclass , cls2 ) ;
}
cls = superclass ;
}
}
return cls2 ;
}
public static Type e ( int i , ParameterizedType parameterizedType ) {
Type [ ] actualTypeArguments = parameterizedType . getActualTypeArguments ( ) ;
if ( i < 0 | | i > = actualTypeArguments . length ) {
2021-10-14 23:16:01 +00:00
StringBuilder P = c . d . b . a . a . P ( " Index " , i , " not in range [0, " ) ;
P . append ( actualTypeArguments . length ) ;
P . append ( " ) for " ) ;
P . append ( parameterizedType ) ;
throw new IllegalArgumentException ( P . toString ( ) ) ;
2021-08-04 22:02:59 +00:00
}
Type type = actualTypeArguments [ i ] ;
return type instanceof WildcardType ? ( ( WildcardType ) type ) . getUpperBounds ( ) [ 0 ] : type ;
}
public static Class < ? > f ( Type type ) {
Objects . requireNonNull ( type , " type == null " ) ;
if ( type instanceof Class ) {
return ( Class ) type ;
}
if ( type instanceof ParameterizedType ) {
Type rawType = ( ( ParameterizedType ) type ) . getRawType ( ) ;
if ( rawType instanceof Class ) {
return ( Class ) rawType ;
}
throw new IllegalArgumentException ( ) ;
} else if ( type instanceof GenericArrayType ) {
return Array . newInstance ( f ( ( ( GenericArrayType ) type ) . getGenericComponentType ( ) ) , 0 ) . getClass ( ) ;
} else {
if ( type instanceof TypeVariable ) {
return Object . class ;
}
if ( type instanceof WildcardType ) {
return f ( ( ( WildcardType ) type ) . getUpperBounds ( ) [ 0 ] ) ;
}
throw new IllegalArgumentException ( " Expected a Class, ParameterizedType, or GenericArrayType, but < " + type + " > is of type " + type . getClass ( ) . getName ( ) ) ;
}
}
public static Type g ( Type type , Class < ? > cls , Class < ? > cls2 ) {
if ( cls2 . isAssignableFrom ( cls ) ) {
return n ( type , cls , d ( type , cls , cls2 ) ) ;
}
throw new IllegalArgumentException ( ) ;
}
public static boolean h ( Type type ) {
if ( type instanceof Class ) {
return false ;
}
if ( type instanceof ParameterizedType ) {
for ( Type type2 : ( ( ParameterizedType ) type ) . getActualTypeArguments ( ) ) {
if ( h ( type2 ) ) {
return true ;
}
}
return false ;
} else if ( type instanceof GenericArrayType ) {
return h ( ( ( GenericArrayType ) type ) . getGenericComponentType ( ) ) ;
} else {
if ( ( type instanceof TypeVariable ) | | ( type instanceof WildcardType ) ) {
return true ;
}
throw new IllegalArgumentException ( " Expected a Class, ParameterizedType, or GenericArrayType, but < " + type + " > is of type " + ( type = = null ? " null " : type . getClass ( ) . getName ( ) ) ) ;
}
}
public static boolean i ( Annotation [ ] annotationArr , Class < ? extends Annotation > cls ) {
for ( Annotation annotation : annotationArr ) {
if ( cls . isInstance ( annotation ) ) {
return true ;
}
}
return false ;
}
public static RuntimeException j ( Method method , String str , Object . . . objArr ) {
return k ( method , null , str , objArr ) ;
}
public static RuntimeException k ( Method method , Throwable th , String str , Object . . . objArr ) {
2021-10-14 23:16:01 +00:00
StringBuilder S = c . d . b . a . a . S ( String . format ( str , objArr ) , " \ n for method " ) ;
S . append ( method . getDeclaringClass ( ) . getSimpleName ( ) ) ;
S . append ( " . " ) ;
S . append ( method . getName ( ) ) ;
return new IllegalArgumentException ( S . toString ( ) , th ) ;
2021-08-04 22:02:59 +00:00
}
public static RuntimeException l ( Method method , int i , String str , Object . . . objArr ) {
2021-10-14 23:16:01 +00:00
StringBuilder S = c . d . b . a . a . S ( str , " (parameter # " ) ;
S . append ( i + 1 ) ;
S . append ( " ) " ) ;
return j ( method , S . toString ( ) , objArr ) ;
2021-08-04 22:02:59 +00:00
}
public static RuntimeException m ( Method method , Throwable th , int i , String str , Object . . . objArr ) {
2021-10-14 23:16:01 +00:00
StringBuilder S = c . d . b . a . a . S ( str , " (parameter # " ) ;
S . append ( i + 1 ) ;
S . append ( " ) " ) ;
return k ( method , th , S . toString ( ) , objArr ) ;
2021-06-27 20:44:35 +00:00
}
2021-08-04 22:02:59 +00:00
/* JADX DEBUG: Failed to insert an additional move for type inference into block B:73:? */
/* JADX WARNING: Removed duplicated region for block: B:21:0x0043 A[LOOP:0: B:0:0x0000->B:21:0x0043, LOOP_END] */
/* JADX WARNING: Removed duplicated region for block: B:70:0x0042 A[SYNTHETIC] */
public static Type n ( Type type , Class < ? > cls , Type type2 ) {
TypeVariable typeVariable ;
while ( true ) {
int i = 0 ;
if ( type2 instanceof TypeVariable ) {
TypeVariable typeVariable2 = ( TypeVariable ) type2 ;
GenericDeclaration genericDeclaration = typeVariable2 . getGenericDeclaration ( ) ;
Class cls2 = genericDeclaration instanceof Class ? ( Class ) genericDeclaration : null ;
if ( cls2 ! = null ) {
Type d = d ( type , cls , cls2 ) ;
if ( d instanceof ParameterizedType ) {
TypeVariable [ ] typeParameters = cls2 . getTypeParameters ( ) ;
while ( i < typeParameters . length ) {
if ( typeVariable2 . equals ( typeParameters [ i ] ) ) {
typeVariable = ( ( ParameterizedType ) d ) . getActualTypeArguments ( ) [ i ] ;
if ( typeVariable ! = typeVariable2 ) {
return typeVariable ;
}
type2 = typeVariable ;
} else {
i + + ;
}
}
throw new NoSuchElementException ( ) ;
}
}
typeVariable = typeVariable2 ;
if ( typeVariable ! = typeVariable2 ) {
}
} else {
if ( type2 instanceof Class ) {
Class cls3 = ( Class ) type2 ;
if ( cls3 . isArray ( ) ) {
Class < ? > componentType = cls3 . getComponentType ( ) ;
Type n = n ( type , cls , componentType ) ;
return componentType = = n ? cls3 : new a ( n ) ;
}
}
if ( type2 instanceof GenericArrayType ) {
GenericArrayType genericArrayType = ( GenericArrayType ) type2 ;
Type genericComponentType = genericArrayType . getGenericComponentType ( ) ;
Type n2 = n ( type , cls , genericComponentType ) ;
return genericComponentType = = n2 ? genericArrayType : new a ( n2 ) ;
} else if ( type2 instanceof ParameterizedType ) {
ParameterizedType parameterizedType = ( ParameterizedType ) type2 ;
Type ownerType = parameterizedType . getOwnerType ( ) ;
Type n3 = n ( type , cls , ownerType ) ;
boolean z2 = n3 ! = ownerType ;
Type [ ] actualTypeArguments = parameterizedType . getActualTypeArguments ( ) ;
int length = actualTypeArguments . length ;
while ( i < length ) {
Type n4 = n ( type , cls , actualTypeArguments [ i ] ) ;
if ( n4 ! = actualTypeArguments [ i ] ) {
if ( ! z2 ) {
actualTypeArguments = ( Type [ ] ) actualTypeArguments . clone ( ) ;
z2 = true ;
}
actualTypeArguments [ i ] = n4 ;
}
i + + ;
}
return z2 ? new b ( n3 , parameterizedType . getRawType ( ) , actualTypeArguments ) : parameterizedType ;
} else {
boolean z3 = type2 instanceof WildcardType ;
WildcardType wildcardType = type2 ;
if ( z3 ) {
WildcardType wildcardType2 = ( WildcardType ) type2 ;
Type [ ] lowerBounds = wildcardType2 . getLowerBounds ( ) ;
Type [ ] upperBounds = wildcardType2 . getUpperBounds ( ) ;
if ( lowerBounds . length = = 1 ) {
Type n5 = n ( type , cls , lowerBounds [ 0 ] ) ;
wildcardType = wildcardType2 ;
if ( n5 ! = lowerBounds [ 0 ] ) {
return new c ( new Type [ ] { Object . class } , new Type [ ] { n5 } ) ;
}
} else {
wildcardType = wildcardType2 ;
if ( upperBounds . length = = 1 ) {
Type n6 = n ( type , cls , upperBounds [ 0 ] ) ;
wildcardType = wildcardType2 ;
if ( n6 ! = upperBounds [ 0 ] ) {
return new c ( new Type [ ] { n6 } , a ) ;
}
}
}
}
return wildcardType ;
}
}
}
2021-06-27 20:44:35 +00:00
}
2021-08-04 22:02:59 +00:00
public static void o ( Throwable th ) {
if ( th instanceof VirtualMachineError ) {
throw ( ( VirtualMachineError ) th ) ;
} else if ( th instanceof ThreadDeath ) {
throw ( ( ThreadDeath ) th ) ;
} else if ( th instanceof LinkageError ) {
throw ( ( LinkageError ) th ) ;
}
2021-06-27 20:44:35 +00:00
}
2021-08-04 22:02:59 +00:00
public static String p ( Type type ) {
return type instanceof Class ? ( ( Class ) type ) . getName ( ) : type . toString ( ) ;
2021-06-27 20:44:35 +00:00
}
}