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

Multiple patterns without unnamed variables

    XMLWordPrintable

Details

    • b12

    Backports

      Description

        [~tvaleev] reported the following case which should be protected under the --enable-preview flag for JEP 443

        https://mail.openjdk.org/pipermail/amber-spec-experts/2023-August/003909.html

        public class Test {
          record R1() {}
          record R2() {}

          static void test(Object obj) {
            switch (obj) {
              case R1(), R2() -> System.out.println("R1 or R2");
              default -> System.out.println("other");
            }
          }

          public static void main(String[] args) {
            test(new R1());
          }
        }

        Attachments

          Issue Links

            Activity

              People

                abimpoudis Angelos Bimpoudis
                abimpoudis Angelos Bimpoudis
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: