PsiStatement (final PsiSwitchStatement switchStatement, final PsiType enumValueType, final Set<Object> enumValues) { final PsiExpression expression = switchStatement.getExpression(); if (expression != null) { final PsiType expressionType = expression.getType(); if (expressionType != null && !TypeConversionUtil.isAssignable(expressionType, enumValueType)) { return switchStatement; } final PsiConstantEvaluationHelper evaluationHelper = JavaPsiFacade.getInstance(expression.getProject()).getConstantEvaluationHelper(); final PsiCodeBlock body = switchStatement.getBody(); if (body != null) { for (PsiStatement statement : body.getStatements()) { if (statement instanceof PsiSwitchLabelStatement labelStatement) { final Object caseValue = evaluationHelper.computeConstantExpression(labelStatement.getCaseValue()); if (caseValue != null && !enumValues.contains(caseValue)) return statement; } } return null; } } return switchStatement; }