public static int calculateBranchCount(@NotNull PsiSwitchBlock block) {
    List<PsiElement> switchBranches = getSwitchBranches(block);
    if (switchBranches.isEmpty()) return 0;
    int branches = 0;
    boolean defaultFound = false;
    for (PsiElement branch : switchBranches) {
      if (branch instanceof PsiSwitchLabelStatementBase) {
        if (((PsiSwitchLabelStatementBase)branch).isDefaultCase()) {
          defaultFound = true;
        }
      }
      else if (branch instanceof PsiCaseLabelElement) {
        if (branch instanceof PsiDefaultCaseLabelElement) {
          defaultFound = true;
        }
        else {
          branches++;
        }
      }
    }
    final PsiCodeBlock body = block.getBody();
    if (body == null) {
      return 0;
    }
    return defaultFound ? -branches - 1 : branches;
  }
public static int calculateBranchCount(@NotNull PsiSwitchBlock block)