Description
This is very likely related to #4972.
My method signature looks like this
public static <T> ObservableTransformer<T, T> takeWhileViewAttachedObservable(Presenter presenter) {}
This is a generic transformer which we reuse in our project. In Java 7 it was possible to specify the type, so that subscribers below knew the correct type
.compose(Transformers.<String>takeWhileViewAttachedObservable(presenter))
Even better in Java 8 and Kotlin we could avoid the type declaration.
After updating to 2.0.5
our code in Kotlin broke. Subscribers below the compose()
method, didn't see the correct type anymore, but only Any
(equivalent to Object
).
.compose(Transformers.takeWhileViewAttachedObservable(presenter))
.subscribe {
val myString = it // is not a string anymore
}
I changed the method signature from our reusable transformer to
public static <T> ObservableTransformer<? super T, ? extends T> takeWhileViewAttachedObservable(Presenter presenter) {}
That fixed the problem in Kotlin, but now Java 8 code is complaining and only sees Object
and not the correct event type anymore.
I don't know why that's the case or how the best solution looks like. I'm wondering if this change was necessary.