Hello, I was looking at some of my code and found that jdt-ls gives a false positive error when using switch expressions on sealed interfaces.
Example code snippet:
public sealed interface Day permits SchoolDay, Weekend, Holiday {
// SNIP
default void summary() {
switch (this) {
case SchoolDay day -> {
out.println("Finished school day.");
}
case Weekend day -> {
out.println("Finished weekend.");
}
case Holiday day -> {
out.println("Finished holiday.");
}
}
}
Here, jdt-ls gives 7 errors:
Cannot switch on a value of type of this.
SchoolDay cannot be resolved to a variable.
Syntax error on token "day", delete this token.
And similar errors on the other two classes that implement the interface Day.
Apart from that, using sealed interfaces themselves are clunky, and needs better suggestions/code completions.
Hello, I was looking at some of my code and found that
jdt-ls
gives a false positive error when using switch expressions on sealed interfaces.Example code snippet:
Here,
jdt-ls
gives 7 errors:And similar errors on the other two classes that implement the interface
Day
.Apart from that, using sealed interfaces themselves are clunky, and needs better suggestions/code completions.