boolean (@Nullable VirtualFile parent, CharSequence name, String symlinkTarget) { if (startsWith(parent, name, symlinkTarget)) return true; if (!(parent instanceof VirtualFileSystemEntry)) return false; // check if it's circular - any symlink above resolves to my target too for (VirtualFileSystemEntry p = (VirtualFileSystemEntry)parent; p != null; p = p.getParent()) { // if the file has no symlinks up the hierarchy, it's not circular if (!p.thisOrParentHaveSymlink()) return false; if (p.is(VFileProperty.SYMLINK)) { String parentResolved = p.getCanonicalPath(); if (symlinkTarget.equals(parentResolved)) return true; } } return false; }