Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8269141

Switch statement containing pattern case label element gets in the loop during execution

XMLWordPrintable

    • b29

        As noted here:
        https://mail.openjdk.java.net/pipermail/compiler-dev/2021-June/017339.html

        The following code, when compiled and ran, runs in an infinite loop:
        ---
            static void test(Integer i) {
                switch (i) {
                    case Integer o && o != null:
                        System.out.println("s1");
                    default:
                        System.out.println("def");
                }
            }
        ---

              jlahoda Jan Lahoda
              jlahoda Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: