aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessError.java
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/RecordPatternsPreview1ExhaustivenessError.java
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/RecordPatternsPreview1ExhaustivenessError.java')
-rw-r--r--tests/features1919/java19/RecordPatternsPreview1ExhaustivenessError.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessError.java b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessError.java
new file mode 100644
index 000000000..8df079474
--- /dev/null
+++ b/tests/features1919/java19/RecordPatternsPreview1ExhaustivenessError.java
@@ -0,0 +1,22 @@
+public class RecordPatternsPreview1ExhaustivenessError {
+ static Pair<I> p2 = new Pair<>(new C(), new D());
+
+ public static void main(String[] args) {
+ exhaustiveSwitch();
+ }
+
+ static void exhaustiveSwitch() {
+ switch (p2) {
+ case Pair<I>(C fst, D snd) -> System.out.println("a");
+ case Pair<I>(D fst, C snd) -> System.out.println("b");
+ case Pair<I>(I fst, C snd) -> System.out.println("c");
+ }
+ }
+}
+
+class A { }
+class B extends A { }
+sealed interface I permits C, D { }
+final class C implements I { }
+final class D implements I { }
+record Pair<T>(T x, T y) { }