import org.jetbrains.annotations.Nullable; class Test { void test(){ @Nullable String s = null; if (s == null) return; System.out.println(s); } }