private static @NotNull List<PsiComment> getComments(@NotNull PsiElement element) {
    PsiElement[] children = element.getChildren();
    List<PsiComment> comments = new ArrayList<>();

    for (PsiElement e : children) {
      if (e instanceof PsiComment) {
        comments.add((PsiComment)e);
      }
      else if (!(e instanceof PsiWhiteSpace)) {
        return comments;
      }
    }

    return comments;
  }
private static @NotNull List<PsiComment> getComments(@NotNull PsiElement element)