I'd like some way to inform my Kotlin library that a Java class provided from a library can be treated as if it has
in
or
out
generics. For example, in
RxJava, we have
Single<T>
, which in Kotlin would have been represented as
Single<out T>
.
Ideally, there'd be some directive like
import io.reactivex.rxjava3.core.Single as Single<out T>
, which could be conveniently distributed through an entire project, perhaps by each file in the project importing from some file containing directives like this.
Would something like this be reasonable to add, or would the complications or the risk of someone importing a class that doesn't actually conform to
out
be too great?