Error when parsing qualified generic type test pattern in switch

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 24
    • Affects Version/s: 24
    • Component/s: tools
    • None
    • b27

      The following program does not compile:

      ```
      abstract sealed class J<T1, T2> permits X.S, A {}

      final class A extends J<Integer, String> {}

      public class X<T> {

          final class S<U> extends J<T, U> {}

          int testExhaustive(J<Integer, String> ji) {
              return switch (ji) {
                  case A a -> 42;
                  case X<Integer>.S<String> e -> 4200;
              };
          }
          public static void main(String[] args) {
              X<Integer>.S<String> xs = null;
              System.out.println(new X<Integer>().testExhaustive(new X<Integer>().new S<String>()));
          }
      }
      ```

      See:
      https://mail.openjdk.org/pipermail/compiler-dev/2024-November/028464.html

            Assignee:
            Angelos Bimpoudis
            Reporter:
            Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: