boolean (@Nullable PsiSwitchLabelStatementBase label) { if (label == null) return false; if (isDefaultLabel(label)) return true; PsiSwitchBlock switchBlock = label.getEnclosingSwitchBlock(); if (switchBlock == null) return false; PsiExpression expression = switchBlock.getExpression(); if (expression == null) return false; PsiType type = expression.getType(); if (type == null) return false; PsiCaseLabelElementList labelElementList = label.getCaseLabelElementList(); if (labelElementList == null) return false; return StreamEx.of(labelElementList.getElements()) .select(PsiPattern.class) .anyMatch(pattern -> JavaPsiPatternUtil.isUnconditionalForType(pattern, type)); }