[BUG] [Java] RxJava2CallAdapterFactory should not be used & io.reactivex.Observable / io.reactivex.Completable not imported when useRxJava2: 'false'
Created by: vorburger
When using useRxJava2: 'false'
, then the com.squareup.retrofit2:adapter-rxjava2
dependency (and due to & through it transitively its own dependency org.reactivestreams:reactive-streams
) are still required - even though they should not be used in the generated code with that configuration.
The reason for that is that the generated ApiClient
has an import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
because createDefaultAdapter()
does a .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
- which, of course, isn't actually needed when using useRxJava2: 'false'
. Similarly, all classes generated into the apiPackage
folder always have an import io.reactivex.Observable;
and a import io.reactivex.Completable;
even though, again, they are not used anywhere with useRxJava2: 'false'
.
The templates could thus be improved to skip those lines for users who don't need Rx.