提交 777b5205 编写于 作者: J Jesse Wilson 提交者: GitHub

Merge pull request #2095 from square/jw/remove-robovm

Remove RoboVM support.
......@@ -20,7 +20,6 @@ import android.os.Handler;
import android.os.Looper;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.concurrent.Executor;
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
......@@ -45,11 +44,6 @@ class Platform {
return new Java8();
} catch (ClassNotFoundException ignored) {
}
try {
Class.forName("org.robovm.apple.foundation.NSObject");
return new IOS();
} catch (ClassNotFoundException ignored) {
}
return new Platform();
}
......@@ -109,47 +103,4 @@ class Platform {
}
}
}
static class IOS extends Platform {
@Override public Executor defaultCallbackExecutor() {
return new MainThreadExecutor();
}
@Override CallAdapter.Factory defaultCallAdapterFactory(Executor callbackExecutor) {
return new ExecutorCallAdapterFactory(callbackExecutor);
}
static class MainThreadExecutor implements Executor {
private static Object queue;
private static Method addOperation;
static {
try {
// queue = NSOperationQueue.getMainQueue();
Class<?> operationQueue = Class.forName("org.robovm.apple.foundation.NSOperationQueue");
queue = operationQueue.getDeclaredMethod("getMainQueue").invoke(null);
addOperation = operationQueue.getDeclaredMethod("addOperation", Runnable.class);
} catch (Exception e) {
throw new AssertionError(e);
}
}
@Override public void execute(Runnable r) {
try {
// queue.addOperation(r);
addOperation.invoke(queue, r);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new AssertionError(e);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else if (cause instanceof Error) {
throw (Error) cause;
}
throw new RuntimeException(cause);
}
}
}
}
}
......@@ -175,8 +175,6 @@ compile 'com.squareup.retrofit2:retrofit:<span class="version pln"><em>(insert l
<pre class="prettyprint">
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on RoboVM on iOS. Will not be used at runtime.
-dontnote retrofit2.Platform$IOS$MainThreadExecutor
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain generic type information for use by reflection by converters and adapters.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册