aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features1919/java19/RecordPatternsPreview1OK.java
blob: ba62f79d5b8c1b18e0a9d584eb417accfd8e00b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
public class RecordPatternsPreview1OK {
  static void printGenericBoxString1(Box<Object> objectBox) {
    if (objectBox instanceof Box<Object>(String s)) {
      System.out.println(s);
    }
  }

  static void printGenericBoxString2(Box<String> stringBox) {
    if (stringBox instanceof Box<String>(var s)) {
      System.out.println(s);
    }
  }
}

record Box<T>(T t) {}