mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
EnumSwitchStatementWhichMissesCasesInspection: support parentheses
GitOrigin-RevId: 69613540477755d6d196f338ccdc1daee946a6da
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c76e1b4108
commit
65e26a8b33
@@ -47,7 +47,7 @@ public class EnumSwitchStatementWhichMissesCasesInspection extends AbstractBaseJ
|
||||
public boolean ignoreSwitchStatementsWithDefault = true;
|
||||
|
||||
@NotNull
|
||||
String buildErrorString(String enumName, Set<String> names) {
|
||||
static String buildErrorString(String enumName, Set<String> names) {
|
||||
if (names.size() == 1) {
|
||||
return InspectionGadgetsBundle
|
||||
.message("enum.switch.statement.which.misses.cases.problem.descriptor.single", enumName, names.iterator().next());
|
||||
@@ -78,7 +78,7 @@ public class EnumSwitchStatementWhichMissesCasesInspection extends AbstractBaseJ
|
||||
}
|
||||
|
||||
public void processSwitchBlock(@NotNull PsiSwitchBlock switchBlock) {
|
||||
final PsiExpression expression = switchBlock.getExpression();
|
||||
final PsiExpression expression = PsiUtil.skipParenthesizedExprDown(switchBlock.getExpression());
|
||||
if (expression == null) return;
|
||||
final PsiClass aClass = PsiUtil.resolveClassInClassTypeOnly(expression.getType());
|
||||
if (aClass == null || !aClass.isEnum()) return;
|
||||
|
||||
@@ -102,7 +102,7 @@ public class EnumSwitchStatementWhichMissesCasesInspectionTest extends LightJava
|
||||
"class X {\n" +
|
||||
" void m(E e) {\n" +
|
||||
" if(e == E.C) return;\n" +
|
||||
" switch (e) {\n" +
|
||||
" switch ((e)) {\n" +
|
||||
" case A:\n" +
|
||||
" case B:\n" +
|
||||
" }\n" +
|
||||
|
||||
Reference in New Issue
Block a user