protected @Nullable <E extends PsiElement> E getStubOrPsiParentOfType(@NotNull Class<E> parentClass) {
    T stub = getStub();
    if (stub != null) {
      //noinspection unchecked
      return (E)stub.getParentStubOfType(parentClass);
    }
    return PsiTreeUtil.getParentOfType(this, parentClass);
  }
protected @Nullable <E extends PsiElement> E getStubOrPsiParentOfType(@NotNull Class<E> parentClass)