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
```
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
- links to
-
Commit(master) openjdk/jdk/ec93cc50
-
Review(master) openjdk/jdk/22487