@Nullable
  public <Ancestor extends PsiElement> Location<Ancestor> getParent(Class<Ancestor> parentClass) {
    Iterator<Location<PsiElement>> ancestors = getAncestors(PsiElement.class, true);
    if (ancestors.hasNext()) {
      Location<? extends PsiElement> parent = ancestors.next();
      if (parentClass.isInstance(parent.getPsiElement())) {
        @SuppressWarnings("unchecked") Location<Ancestor> location = (Location<Ancestor>)parent;
        return location;
      }
    }
    return null;
  }
@Nullable
  public <Ancestor extends PsiElement> Location<Ancestor> getParent(Class<Ancestor> parentClass)