From 400e0f75441d4027c8ccdc5f18c1b06f7bc479d9 Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Thu, 22 Apr 2021 07:53:25 +0200 Subject: [fixes #2624] Resolve variables in switch expressions --- .../resource/after-delombok/ValSwitchExpression.java | 11 +++++++++++ .../resource/after-ecj/ValSwitchExpression.java | 16 ++++++++++++++++ test/transform/resource/before/ValSwitchExpression.java | 13 +++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 test/transform/resource/after-delombok/ValSwitchExpression.java create mode 100644 test/transform/resource/after-ecj/ValSwitchExpression.java create mode 100644 test/transform/resource/before/ValSwitchExpression.java (limited to 'test/transform/resource') diff --git a/test/transform/resource/after-delombok/ValSwitchExpression.java b/test/transform/resource/after-delombok/ValSwitchExpression.java new file mode 100644 index 00000000..a8fa9b0f --- /dev/null +++ b/test/transform/resource/after-delombok/ValSwitchExpression.java @@ -0,0 +1,11 @@ +// version 14: +public class ValSwitchExpression { + public void method(int arg) { + final int x = switch (arg) { + default -> { + final java.lang.String s = "string"; + yield arg; + } + }; + } +} \ No newline at end of file diff --git a/test/transform/resource/after-ecj/ValSwitchExpression.java b/test/transform/resource/after-ecj/ValSwitchExpression.java new file mode 100644 index 00000000..59b503cb --- /dev/null +++ b/test/transform/resource/after-ecj/ValSwitchExpression.java @@ -0,0 +1,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; + } + }; + } +} \ No newline at end of file diff --git a/test/transform/resource/before/ValSwitchExpression.java b/test/transform/resource/before/ValSwitchExpression.java new file mode 100644 index 00000000..c3838acc --- /dev/null +++ b/test/transform/resource/before/ValSwitchExpression.java @@ -0,0 +1,13 @@ +// version 14: +import lombok.val; + +public class ValSwitchExpression { + public void method(int arg) { + val x = switch (arg) { + default -> { + val s = "string"; + yield arg; + } + }; + } +} -- cgit