[java][switch completion] IDEA-278622 Fix completion variants in switch case label

Use the `inheritorsFilter` when the element that is being filtered is of the PsiClass type regardless if the selector class of a switch block is sealed or not. All the inheritors of the sealed class get added in JavaCompletionProcessor.

GitOrigin-RevId: 28e70b44444edad329f086a9dca0557baea03bec
This commit is contained in:
Nikita Eshkeev
2021-09-24 23:51:09 +03:00
committed by intellij-monorepo-bot
parent 13dec23fbc
commit 90db265d7a
6 changed files with 89 additions and 44 deletions

View File

@@ -0,0 +1,24 @@
class Main {
public static abstract sealed class Sealed {
public static final class SealedInheritor extends Sealed {}
}
int f(Sealed o) {
return switch(o) {
case Sealed.SealedIn<caret>, null
}
}
int g(Sealed o) {
return switch(o) {
case null, Sealed.SealedIn<caret>
}
}
int h(Sealed o) {
return switch(o) {
case Sealed.SealedIn<caret>
}
}
}

View File

@@ -0,0 +1,24 @@
class Main {
public static abstract sealed class Sealed {
public static final class SealedInheritor extends Sealed {}
}
int f(Sealed o) {
return switch(o) {
case Sealed.SealedInheritor, null
}
}
int g(Sealed o) {
return switch(o) {
case null, Sealed.SealedInheritor
}
}
int h(Sealed o) {
return switch(o) {
case Sealed.SealedInheritor
}
}
}