desseim
09/29/2015, 12:17 PMclass Observable<T> {
T get() { }
void subscribe(Subscriber<? super T> s) { }
}
Observable<String> obs = //…
Subscriber<CharSequence> sub = //...
Observable<? extends CharSequence> obsView = obs;
obsView.subscribe(sub);
Any way to write the 2 last lines in Kotlin ?
I don’t think it’s unsafe, just that in Kotlin I would try with projections and since they loose the original parameter type (String
here) the compiler cannot infer the safety of the call to subscribe()
(and hides it anyway). Am I missing something ??