From:
https://mail.openjdk.org/pipermail/amber-dev/2022-September/007508.html
This should compile:
---
public class Example {
sealed interface Action {
record PrintAction() implements Action {}
record DeleteAction() implements Action {}
}
public int foo(Action action) {
switch (action) {
case Action.PrintAction printAction -> {
return 1;
}
case Action.DeleteAction deleteAction -> {
return 2;
}
}
}
}
---
https://mail.openjdk.org/pipermail/amber-dev/2022-September/007508.html
This should compile:
---
public class Example {
sealed interface Action {
record PrintAction() implements Action {}
record DeleteAction() implements Action {}
}
public int foo(Action action) {
switch (action) {
case Action.PrintAction printAction -> {
return 1;
}
case Action.DeleteAction deleteAction -> {
return 2;
}
}
}
}
---