List<PsiEnumConstant> (PsiSwitchLabelStatementBase label) { if (label == null) { return Collections.emptyList(); } final PsiCaseLabelElementList list = label.getCaseLabelElementList(); if (list == null) { return Collections.emptyList(); } List<PsiEnumConstant> constants = new ArrayList<>(); for (PsiCaseLabelElement labelElement : list.getElements()) { if (labelElement instanceof PsiDefaultCaseLabelElement || labelElement instanceof PsiExpression expr && ExpressionUtils.isNullLiteral(expr)) { continue; } if (labelElement instanceof PsiReferenceExpression) { final PsiElement target = ((PsiReferenceExpression)labelElement).resolve(); if (target instanceof PsiEnumConstant) { constants.add((PsiEnumConstant)target); continue; } } return Collections.emptyList(); } return constants; }