ralf
01/27/2017, 12:31 PM// old : public final <R> Flowable<R> compose(FlowableTransformer<T, R> composer) {}
public final <R> Flowable<R> compose(FlowableTransformer<? super T, ? extends R> composer) {}
If I call this method in Java 7, then I can pass in the type, so that following subscribers know the correct type, e.g.
// every subscriber below will see a String
.compose(Transformers.<String>takeWhileViewAttachedObservable(presenter))
Previously that wasn’t necessary in Kotlin and I could simply call .compose(Transformers.takeWhileViewAttachedObservable(presenter))
. But with the latest change, that doesn’t work anymore and every subscriber receives Any
.
.compose(Transformers.takeWhileViewAttachedObservable(this))
.subscribe {
val myString = it // is not a string anymore
}
What’s the best way to solve this? How can I cast the type?