List<PsiElement> (@NotNull PsiSwitchBlock block) { final PsiCodeBlock body = block.getBody(); if (body == null) return Collections.emptyList(); List<PsiElement> result = new SmartList<>(); for (PsiSwitchLabelStatementBase child : PsiTreeUtil.getChildrenOfTypeAsList(body, PsiSwitchLabelStatementBase.class)) { if (child.isDefaultCase()) { result.add(child); } else { PsiCaseLabelElementList labelElementList = child.getCaseLabelElementList(); if (labelElementList == null) continue; Collections.addAll(result, labelElementList.getElements()); } } return result; }