private static boolean isNotUsed(@NotNull PsiVariable variable, @NotNull PsiStatement switchStatement) {
      try {
        ControlFlow controlFlow = ControlFlowFactory
          .getControlFlow(switchStatement, AllVariablesControlFlowPolicy.getInstance(), ControlFlowOptions.NO_CONST_EVALUATE);
        List<PsiReferenceExpression> references = ControlFlowUtil.getReadBeforeWrite(controlFlow);
        for (PsiReferenceExpression reference : references) {
          if (reference != null && reference.resolve() == variable) {
            return false;
          }
        }
        return true;
      }
      catch (AnalysisCanceledException e) {
        return false;
      }
    }
private static boolean isNotUsed(@NotNull PsiVariable variable, @NotNull PsiStatement switchStatement)