1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// version 14: import lombok.val; public class ValSwitchExpression { public ValSwitchExpression() { super(); } public void method(int arg) { final @val int x = switch (arg) { default -> { final @val java.lang.String s = "string"; yield arg; } }; } }