Initial import of ADIF API reverse-engineering toolkit
This commit is contained in:
102
apk_decompiled/sources/retrofit2/Platform.java
Normal file
102
apk_decompiled/sources/retrofit2/Platform.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package retrofit2;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
|
||||
import retrofit2.CallAdapter;
|
||||
import retrofit2.Converter;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
class Platform {
|
||||
private static final Platform PLATFORM = findPlatform();
|
||||
private final boolean hasJava8Types;
|
||||
private final Constructor<MethodHandles.Lookup> lookupConstructor;
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class Android extends Platform {
|
||||
|
||||
/* loaded from: classes3.dex */
|
||||
public static final class MainThreadExecutor implements Executor {
|
||||
private final Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
@Override // java.util.concurrent.Executor
|
||||
public void execute(Runnable runnable) {
|
||||
this.handler.post(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
public Android() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
@Override // retrofit2.Platform
|
||||
public Executor defaultCallbackExecutor() {
|
||||
return new MainThreadExecutor();
|
||||
}
|
||||
|
||||
@Override // retrofit2.Platform
|
||||
public Object invokeDefaultMethod(Method method, Class<?> cls, Object obj, Object... objArr) throws Throwable {
|
||||
return super.invokeDefaultMethod(method, cls, obj, objArr);
|
||||
}
|
||||
}
|
||||
|
||||
public Platform(boolean z3) {
|
||||
this.hasJava8Types = z3;
|
||||
Constructor<MethodHandles.Lookup> constructor = null;
|
||||
if (z3) {
|
||||
try {
|
||||
constructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, Integer.TYPE);
|
||||
constructor.setAccessible(true);
|
||||
} catch (NoClassDefFoundError | NoSuchMethodException unused) {
|
||||
}
|
||||
}
|
||||
this.lookupConstructor = constructor;
|
||||
}
|
||||
|
||||
private static Platform findPlatform() {
|
||||
return "Dalvik".equals(System.getProperty("java.vm.name")) ? new Android() : new Platform(true);
|
||||
}
|
||||
|
||||
public static Platform get() {
|
||||
return PLATFORM;
|
||||
}
|
||||
|
||||
public List<? extends CallAdapter.Factory> defaultCallAdapterFactories(Executor executor) {
|
||||
DefaultCallAdapterFactory defaultCallAdapterFactory = new DefaultCallAdapterFactory(executor);
|
||||
return this.hasJava8Types ? Arrays.asList(CompletableFutureCallAdapterFactory.INSTANCE, defaultCallAdapterFactory) : Collections.singletonList(defaultCallAdapterFactory);
|
||||
}
|
||||
|
||||
public int defaultCallAdapterFactoriesSize() {
|
||||
return this.hasJava8Types ? 2 : 1;
|
||||
}
|
||||
|
||||
public Executor defaultCallbackExecutor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<? extends Converter.Factory> defaultConverterFactories() {
|
||||
return this.hasJava8Types ? Collections.singletonList(OptionalConverterFactory.INSTANCE) : Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
public int defaultConverterFactoriesSize() {
|
||||
return this.hasJava8Types ? 1 : 0;
|
||||
}
|
||||
|
||||
@IgnoreJRERequirement
|
||||
public Object invokeDefaultMethod(Method method, Class<?> cls, Object obj, Object... objArr) throws Throwable {
|
||||
Constructor<MethodHandles.Lookup> constructor = this.lookupConstructor;
|
||||
return (constructor != null ? constructor.newInstance(cls, -1) : MethodHandles.lookup()).unreflectSpecial(method, cls).bindTo(obj).invokeWithArguments(objArr);
|
||||
}
|
||||
|
||||
@IgnoreJRERequirement
|
||||
public boolean isDefaultMethod(Method method) {
|
||||
return this.hasJava8Types && method.isDefault();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user