Java: Infer nullability annotations for extracted method's parameters (IDEA-150243)

This commit is contained in:
Pavel Dolgov
2017-06-19 12:54:10 +03:00
parent 99bbe2e66e
commit f060340474
18 changed files with 483 additions and 4 deletions
@@ -0,0 +1,31 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
class C {
void f() {
I i = new I() {
@Override
public void m(@Nullable Object o) {
if (o != null) {
newMethod(o);
}
}
};
}
private void newMethod(@NotNull Object o) {
if (o instanceof String) {
o = 2;
} else {
System.out.println(o);
}
g(o);
}
void g(@NotNull Object o) {
}
interface I {
void m(Object o);
}
}