boolean (PsiSwitchStatement statement) { PsiExpression selector = statement.getExpression(); if (selector == null) return false; PsiClass selectorClass = PsiUtil.resolveClassInClassTypeOnly(selector.getType()); if (selectorClass == null || !selectorClass.isEnum()) { return SwitchUtils.findDefaultElement(statement) == null; } Set<PsiEnumConstant> missingConstants = StreamEx.of(selectorClass.getFields()).select(PsiEnumConstant.class).toMutableSet(); for (PsiSwitchLabelStatementBase child : PsiTreeUtil.getChildrenOfTypeAsList(statement.getBody(), PsiSwitchLabelStatementBase.class)) { if (SwitchUtils.findDefaultElement(child) != null) return false; for (PsiEnumConstant constant : SwitchUtils.findEnumConstants(child)) { missingConstants.remove(constant); if (missingConstants.isEmpty()) return false; } } // Don't need to care about pattern switches (e.g., over sealed types), as non-exhaustive pattern switch statements are non-compilable return true; }