Skip to content

Commit 6df6806

Browse files
PlastixIván Carballo
authored andcommitted
Update RxJava to 1.1.4 and remove RxSchedulersOverrideRule hack (ribot#37)
This removes the reflection used in RxSchedulersOverrideRule to call RxJavaPlugin's reset() method since this method is now public in version 1.1.4
1 parent 7a0c40b commit 6df6806

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ dependencies {
108108

109109
compile 'com.github.bumptech.glide:glide:3.7.0'
110110
compile 'io.reactivex:rxandroid:1.1.0'
111-
compile 'io.reactivex:rxjava:1.1.2'
111+
compile 'io.reactivex:rxjava:1.1.4'
112112
compile "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
113113
compile 'com.jakewharton.timber:timber:4.1.0'
114114
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {

app/src/test/java/uk/co/ribot/androidboilerplate/util/RxSchedulersOverrideRule.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
import org.junit.runner.Description;
55
import org.junit.runners.model.Statement;
66

7-
import java.lang.reflect.InvocationTargetException;
8-
import java.lang.reflect.Method;
9-
107
import rx.Scheduler;
118
import rx.android.plugins.RxAndroidPlugins;
129
import rx.android.plugins.RxAndroidSchedulersHook;
@@ -41,30 +38,21 @@ public Scheduler getMainThreadScheduler() {
4138
}
4239
};
4340

44-
// Hack to get around RxJavaPlugins.reset() not being public
45-
// See https://github.com/ReactiveX/RxJava/issues/2297
46-
// Hopefully the method will be public in new releases of RxAndroid and we can remove the hack.
47-
private void callResetViaReflectionIn(RxJavaPlugins rxJavaPlugins)
48-
throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
49-
Method method = rxJavaPlugins.getClass().getDeclaredMethod("reset");
50-
method.setAccessible(true);
51-
method.invoke(rxJavaPlugins);
52-
}
53-
5441
@Override
5542
public Statement apply(final Statement base, Description description) {
5643
return new Statement() {
5744
@Override
5845
public void evaluate() throws Throwable {
5946
RxAndroidPlugins.getInstance().reset();
6047
RxAndroidPlugins.getInstance().registerSchedulersHook(mRxAndroidSchedulersHook);
61-
callResetViaReflectionIn(RxJavaPlugins.getInstance());
48+
49+
RxJavaPlugins.getInstance().reset();
6250
RxJavaPlugins.getInstance().registerSchedulersHook(mRxJavaSchedulersHook);
6351

6452
base.evaluate();
6553

6654
RxAndroidPlugins.getInstance().reset();
67-
callResetViaReflectionIn(RxJavaPlugins.getInstance());
55+
RxJavaPlugins.getInstance().reset();
6856
}
6957
};
7058
}

0 commit comments

Comments
 (0)