highlight nullable methods that always return a non-null value (IDEA-166399)

This commit is contained in:
peter
2017-01-21 14:22:06 +01:00
parent c2935ef5ea
commit 87f9b34b5b
4 changed files with 65 additions and 0 deletions
@@ -0,0 +1,15 @@
import org.jetbrains.annotations.*;
final class Foo {
@<warning descr="@Nullable method 'foo' always return a non-null value">Nullable</warning> Object foo(int param) {
return param == 1 ? new Object() {
Object unrelated() {
return <warning descr="'null' is returned by the method which is not declared as @Nullable">null</warning>;
}
} : bar();
}
@NotNull Foo bar() {
return this;
}
}