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 var x = switch (arg) { default -> { final @val var s = "string"; yield arg; } }; } }