private static PsiSwitchLabelStatement[] collectLabels(PsiStatement statement) {
      List<PsiSwitchLabelStatement> labels = new ArrayList<>();
      for (PsiElement element = PsiTreeUtil.getPrevSiblingOfType(statement, PsiStatement.class);
           element instanceof PsiSwitchLabelStatement;
           element = PsiTreeUtil.getPrevSiblingOfType(element, PsiStatement.class)) {
        labels.add((PsiSwitchLabelStatement)element);
      }
      Collections.reverse(labels);
      return labels.toArray(EMPTY_LABELS_ARRAY);
    }
private static PsiSwitchLabelStatement[] collectLabels(PsiStatement statement)