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.