import org.jetbrains.annotations.*; public class SwitchExpressionsNullabilityJava12 { void cons(@NotNull String str) {} void test(@Nullable String a, @Nullable String b, int i, boolean f) { cons(((String)(switch(i) { case 1 -> a; case 2 -> "foo"; case 3 -> null; case 4 -> { System.out.println("four!"); break f ? i : b; } default -> "bar"; }))); } }