aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features193/Switch3.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/features193/Switch3.java')
-rw-r--r--tests/features193/Switch3.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/features193/Switch3.java b/tests/features193/Switch3.java
new file mode 100644
index 000000000..a99622d75
--- /dev/null
+++ b/tests/features193/Switch3.java
@@ -0,0 +1,32 @@
+public class Switch3 {
+ public static void main(String[] argv) {
+ System.out.println(one(Color.R));
+ System.out.println(one(Color.G));
+ System.out.println(one(Color.B));
+ System.out.println(one(Color.Y));
+ }
+
+ public static int one(Color color) {
+ int result = switch(color) {
+ case R -> foo(0);
+ case G -> foo(1);
+ case B -> foo(2);
+ default -> foo(3);
+ };
+ return result;
+ }
+
+ public static final int foo(int i) {
+ return i+1;
+ }
+}
+
+enum Color {
+ R, G, B, Y;
+}
+
+aspect X {
+ int around(): call(* foo(..)) {
+ return proceed()*3;
+ }
+} \ No newline at end of file