Java: Infer nullability of extracted method's parameter in presence of a lambda or an anonymous class (IDEA-175727)

This commit is contained in:
Pavel Dolgov
2017-08-22 12:58:24 +03:00
parent f9c4ceda7c
commit 40e2e78e1e
22 changed files with 408 additions and 22 deletions
@@ -0,0 +1,17 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
class C {
void foo(@Nullable Object o) {
while (o != null)
newMethod(o).run();
}
@NotNull
private Runnable newMethod(@NotNull Object o) {
return (Runnable)(() -> bar(o));
}
void bar(@NotNull Object o) {
}
}