Skip to content

Commit d894503

Browse files
author
jmhofer
committed
added variance to Action*, too
1 parent c3058da commit d894503

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

rxjava-core/src/main/java/rx/Observable.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ private Subscription protectivelyWrapAndSubscribe(Observer<T> o) {
247247
return subscription.wrap(subscribe(new SafeObserver<T>(subscription, o)));
248248
}
249249

250-
public Subscription subscribe(final Action1<T> onNext) {
250+
public Subscription subscribe(final Action1<? super T> onNext) {
251251
if (onNext == null) {
252252
throw new IllegalArgumentException("onNext can not be null");
253253
}
@@ -278,11 +278,11 @@ public void onNext(T args) {
278278
});
279279
}
280280

281-
public Subscription subscribe(final Action1<T> onNext, Scheduler scheduler) {
281+
public Subscription subscribe(final Action1<? super T> onNext, Scheduler scheduler) {
282282
return subscribeOn(scheduler).subscribe(onNext);
283283
}
284284

285-
public Subscription subscribe(final Action1<T> onNext, final Action1<Throwable> onError) {
285+
public Subscription subscribe(final Action1<? super T> onNext, final Action1<? super Throwable> onError) {
286286
if (onNext == null) {
287287
throw new IllegalArgumentException("onNext can not be null");
288288
}
@@ -316,11 +316,11 @@ public void onNext(T args) {
316316
});
317317
}
318318

319-
public Subscription subscribe(final Action1<T> onNext, final Action1<Throwable> onError, Scheduler scheduler) {
319+
public Subscription subscribe(final Action1<? super T> onNext, final Action1<? super Throwable> onError, Scheduler scheduler) {
320320
return subscribeOn(scheduler).subscribe(onNext, onError);
321321
}
322322

323-
public Subscription subscribe(final Action1<T> onNext, final Action1<Throwable> onError, final Action0 onComplete) {
323+
public Subscription subscribe(final Action1<? super T> onNext, final Action1<? super Throwable> onError, final Action0 onComplete) {
324324
if (onNext == null) {
325325
throw new IllegalArgumentException("onNext can not be null");
326326
}
@@ -357,7 +357,7 @@ public void onNext(T args) {
357357
});
358358
}
359359

360-
public Subscription subscribe(final Action1<T> onNext, final Action1<Throwable> onError, final Action0 onComplete, Scheduler scheduler) {
360+
public Subscription subscribe(final Action1<? super T> onNext, final Action1<? super Throwable> onError, final Action0 onComplete, Scheduler scheduler) {
361361
return subscribeOn(scheduler).subscribe(onNext, onError, onComplete);
362362
}
363363

rxjava-core/src/main/java/rx/observables/BlockingObservable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ private Subscription protectivelyWrapAndSubscribe(Observer<T> o) {
355355
* @throws RuntimeException
356356
* if an error occurs
357357
*/
358-
public void forEach(final Action1<T> onNext) {
358+
public void forEach(final Action1<? super T> onNext) {
359359
final CountDownLatch latch = new CountDownLatch(1);
360360
final AtomicReference<Throwable> exceptionFromOnError = new AtomicReference<Throwable>();
361361

rxjava-core/src/main/java/rx/util/functions/Functions.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public Void call(Object... args) {
253253
* @param f
254254
* @return {@link FuncN}
255255
*/
256-
public static <T0> FuncN<Void> fromAction(final Action1<T0> f) {
256+
public static <T0> FuncN<Void> fromAction(final Action1<? super T0> f) {
257257
return new FuncN<Void>() {
258258

259259
@SuppressWarnings("unchecked")
@@ -275,7 +275,7 @@ public Void call(Object... args) {
275275
* @param f
276276
* @return {@link FuncN}
277277
*/
278-
public static <T0, T1> FuncN<Void> fromAction(final Action2<T0, T1> f) {
278+
public static <T0, T1> FuncN<Void> fromAction(final Action2<? super T0, ? super T1> f) {
279279
return new FuncN<Void>() {
280280

281281
@SuppressWarnings("unchecked")
@@ -297,7 +297,7 @@ public Void call(Object... args) {
297297
* @param f
298298
* @return {@link FuncN}
299299
*/
300-
public static <T0, T1, T2> FuncN<Void> fromAction(final Action3<T0, T1, T2> f) {
300+
public static <T0, T1, T2> FuncN<Void> fromAction(final Action3<? super T0, ? super T1, ? super T2> f) {
301301
return new FuncN<Void>() {
302302

303303
@SuppressWarnings("unchecked")

0 commit comments

Comments
 (0)