When I use rxjava Android Studio automatically uses
@io.reactivex.annotations.NonNull
as annotation for methods.
Is there any issue if I replace it with the
@android.support.annotation.NonNull
instead?
I'm a bit afraid that I would lose some lint checks but I did not find anything about it
There is no issue with replacing this annotation as it is just an hint for static analysis.
In fact, by default Android Studio would not recognize RxJava2 @io.reactivex.annotations.NonNull
as non null annotation and thus will not assert lint warnings. so if you keep using android default non null (@android.support.annotation.NonNull
) you will be covered by lint.
That also means that all RxJava2 library methods will not be considered with lint, unless you will change Android Studio settings.
To sum it up, it doesn't really matter what non null annotation you're using as long as you add it to lint warnings (o.w. you miss the point with this annotations).
to add RxJava2 annotation to Android Studio inspection, go to Inspection -> Constant conditions & Exception -> configure annotations, in Nullable/NotNull configuration add RxJava NonNull annotation:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With