public static boolean isInvalidLink(@NotNull VirtualFile link) {
    VirtualFile target = link.getCanonicalFile();
    return target == null || target.equals(link) || isAncestor(target, link, true);
  }
public static boolean isInvalidLink(@NotNull VirtualFile link)