public static @Unmodifiable @NotNull <T extends PsiElement> List<T> collectParents(@NotNull PsiElement element,
                                                                                     @NotNull Class<? extends T> parent,
                                                                                     boolean includeMyself,
                                                                                     @NotNull Predicate<? super PsiElement> stopCondition) {
    if (!includeMyself) {
      element = element.getParent();
    }
    List<T> parents = new SmartList<>();
    while (element != null) {
      if (stopCondition.test(element)) break;
      if (parent.isInstance(element)) {
        parents.add(parent.cast(element));
      }
      element = element.getParent();
    }
    return parents;
  }
public static @Unmodifiable @NotNull <T extends PsiElement> List<T> collectParents(@NotNull PsiElement element,
                                                                                     @NotNull Class<? extends T> parent,
                                                                                     boolean includeMyself,
                                                                                     @NotNull Predicate<? super PsiElement> stopCondition)