When IntelliJ autofills an override for a method, the nullability annotations it chooses may not be from the library you want:
Luckily this can be changed! Though the settings for it are buried a bit.
- On the lefthand side, navigate to the menu
Editor > Inspections - In the inspections tree, find and select the entry
@NotNull/@Nullable problems. It should be under:JavaProbable bugsNullability problems@NotNull/@Nullable problems
- On the righthand side, under
Options, scroll down and click the buttonConfigure Annotations.... A popup window should open.
- In the new window, find and select the entry you want to take priority. In the screenshot, that is
javax.annotation.Nullable - Click the Up button at the top of the list until your entry is the first one
- At the top of the window, switch to the
NotNulltab and repeat steps 1 and 2
After that, click the OK button on both windows to save your settings. Now whenever IntelliJ autofills an overridden method, it should insert the annotations that you chose.
Probably missing something - Java/InteliJ is all new to me... On my end, the ordering cannot be changed. I'm using latest community-edition if it makes a diff.