In Android Studio 4.2 beta 1, whenever I implement a method annotated with the androidx version of @Nullable, the IDE is automatically adding the jetbrains @Nullable annotation as well.
This is extremely annoying as it results in code like:
@Nullable
@org.jetbrains.annotations.Nullable
@Override
public String foo(@Nullable @org.jetbrains.annotations.Nullable String bar) {
return null;
}
Any way to prevent this?
I ran into this problem and was able to fix it by going to Settings > Editor > Inspections > Probable Bugs > Nullability > @NotNull / @Nullable annotations. Then under Options, click the Configure Annotations button, select androidx.annotation.Nullable
and androidx.annotation.NonNull
from the respective lists, and press the checkmark to select them as the annotations.
As @jnmorris said, follow these steps :
Go to Settings > Editor > Inspections >
Find Java > Probable Bugs > Nullability Problems > @NotNull/@Nullable Problems
Click Configure Annotations button and check these items
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