aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2022-12-21 12:57:44 +0100
committerAlexander Kriegisch <Alexander@Kriegisch.name>2022-12-21 12:57:44 +0100
commit5239ae0480d4f623aa9c9491b6bf75e3e568cc89 (patch)
treef6bd5d5e80275c25770282eb5b8de4f22db8c6cd /tests/features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj
parent9be61fe259dfd3340050f0c4d80ee9e9555583e1 (diff)
downloadaspectj-5239ae0480d4f623aa9c9491b6bf75e3e568cc89.tar.gz
aspectj-5239ae0480d4f623aa9c9491b6bf75e3e568cc89.zip
Add tests for Java 19 record patterns
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj')
-rw-r--r--tests/features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj
new file mode 100644
index 000000000..44c7f12d0
--- /dev/null
+++ b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessAspect.aj
@@ -0,0 +1,37 @@
+public aspect RecordPatternsPreview1ExhaustivenessAspect {
+ static Pair<I> p2 = new Pair<>(new C(), new D());
+
+ public static void main(String[] args) {
+ doSomething(p2);
+ }
+
+ public static void doSomething(Pair pair) {
+ System.out.println(pair.toString().replaceAll("@[0-9a-f]+", "@000"));
+ }
+
+ before(Pair pair) : execution(* doSomething(Pair)) && args(pair) {
+ switch (pair) {
+ case Pair<I>(I i, C c) -> System.out.println("x");
+ case Pair<I>(I i, D d) -> System.out.println("y");
+ // TODO: Remove redundant default clause when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455
+ // has been fixed. But even with the default clause, it generates wrong byte code and throws runtime error:
+ // NoSuchMethodError: 'I Pair.x()'
+ default -> System.out.println("z");
+ }
+
+ switch (pair) {
+ case Pair<I>(C c, I i) -> System.out.println("a");
+ case Pair<I>(D d, C c) -> System.out.println("b");
+ case Pair<I>(D d1, D d2) -> System.out.println("c");
+ // TODO: remove redundant default clause when https://github.com/eclipse-jdt/eclipse.jdt.core/issues/455
+ // has been fixed. But even with the default clause, it generates wrong byte code and throws runtime error:
+ // NoSuchMethodError: 'I Pair.x()'
+ default -> System.out.println("d");
+ }
+ }
+}
+
+sealed interface I permits C, D { }
+final class C implements I { }
+final class D implements I { }
+record Pair<T>(T x, T y) { }
28 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Share_Backend.php
blob: 16967526ff66b23f7be2faad75ffffd0bd99ceba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96