Skip to content

Commit

Permalink
Remove RoboVM support.
Browse files Browse the repository at this point in the history
The project died quickly after we merged support, and I must have been high to let someone convince me this was a good idea to add.

If you still need RoboVM support supply your own callback executor to Retrofit.Builder.
  • Loading branch information
JakeWharton committed Nov 22, 2016
1 parent 93e2d1e commit 1246c7e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
49 changes: 0 additions & 49 deletions retrofit/src/main/java/retrofit2/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
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;
Expand All @@ -45,11 +44,6 @@ private static Platform findPlatform() {
return new Java8();
} catch (ClassNotFoundException ignored) {
}
try {
Class.forName("org.robovm.apple.foundation.NSObject");
return new IOS();
} catch (ClassNotFoundException ignored) {
}
return new Platform();
}

Expand Down Expand Up @@ -109,47 +103,4 @@ static class MainThreadExecutor implements Executor {
}
}
}

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);
}
}
}
}
}
2 changes: 0 additions & 2 deletions website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ <h4>ProGuard</h4>
<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.
Expand Down

0 comments on commit 1246c7e

Please sign in to comment.