I decided to use @CheckReturnValue annotation to make sure, that in my code I always subscribe to the flowable object. But I noticed that in some cases it doesn't work. This looks like a Lint problem, but maybe I do smth wrong or don't get smth.
- Method being called.
@CheckReturnValue
fun insertTask(task: Groupie): Completable = Completable.fromAction { dao.insertTask(task) }
.subscribeOn(Schedulers.io())

- Code that calls the method:
fun test(g: Groupie, obj: Any) {
db.insertTask(g) // 1.
when (obj) {
is WebSocketMessage.GroupieUpdate -> {
subs.add(db.getTask(g.id).map { oldGroupie -> g.copy(text = oldGroupie.text) }
.subscribe(
{ t -> db.insertTask(t) }, // 2.
::onError
)
)
db.insertTask(g) // 3.
}
}
}

QUESTION: Why exactly 1st call is marked as wrong by Lint in Android Studio, but 2nd and 3rd are not?
RxJava v2.2.19
Android Studio v3.6.1