@Override
  public @Nullable <E extends PsiElement> E getParentStubOfType(final @NotNull Class<E> parentClass) {
    StubElement<?> parent = myParent;
    while (parent != null) {
      PsiElement psi = parent.getPsi();
      if (parentClass.isInstance(psi)) {
        //noinspection unchecked
        return (E)psi;
      }
      parent = parent.getParentStub();
    }
    return null;
  }
@Override
  public @Nullable <E extends PsiElement> E getParentStubOfType(final @NotNull Class<E> parentClass)