PsiElement (@NotNull PsiSwitchBlock switchBlock) { PsiCodeBlock body = switchBlock.getBody(); if (body == null) return null; for (PsiStatement statement : body.getStatements()) { PsiSwitchLabelStatementBase switchLabelStatement = ObjectUtils.tryCast(statement, PsiSwitchLabelStatementBase.class); if (switchLabelStatement == null) continue; PsiElement defaultElement = findDefaultElement(switchLabelStatement); if (defaultElement != null) return defaultElement; } return null; }