Why am I getting a warning from the "NullableProblems" inspection in IntelliJ on this:
public class Test implements Comparable<Test> { @Override public int compareTo(Test o) { return 0; } } I'm using IntelliJ 14.1.4 and compiling with Java 1.7
Screenshot:

Adding @NotNull before the argument doesn't help:

From Comparable.compareTo:
@throws NullPointerException if the specified object is null So IntelliJ knows, that the object should not be null and adds a @NotNull annotation automatically:
IntelliJ IDEA will look carefully at SDK and libraries bytecode and will infer these annotations automatically so that they can later be used to analyze source code to spot places where you overlooked null.
Your overriden method doesn't include this annotation, so it overrides this behavior making the parameter nullable - against the contract of the Comparable interface.
You can solve this by adding @NotNull before the parameter.
You can also disable this inspection by pressing Alt + Enter, selecting the warning in the popup menu and selecting Disable inspection in the sub-menu.
Check out the Web Help and this thread for more information about @NotNull / @NonNull annotations.
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