import org.jetbrains.annotations.*; import java.util.List; @NotNullByDefault public class JetBrainsNotNullByDefault { String field; String test(String param) { if (param == null) {} if (field == null) {} String local = System.getProperty("a"); if (local == null) {} return null; } T generic(T param) { if (param == null) { return param; } return null; } List genericList(List param) { for (T t : param) { if (t == null) { return null; } } return param; } void use2(String s) { // T is inferred as String from "hello" type if (generic("hello") == null) {} // T is inferred as @NotNull String from the `s` type if (generic(s) == null) {} } void use(List list) { // T is inferred as @NotNull String from the `list` type for (String s : genericList(list)) { if (s == null) {} } } static class StaticInner implements NullableMember { public String myGet() { return null; } @Override public String get() { return null; } } } interface NullableMember { @Nullable String get(); }