boolean () { if (!isSymlink()) return false; NewVirtualFile resolved = getCanonicalFile(); // invalid symlink if (resolved == null) return false; // if it's recursive if (VfsUtilCore.isAncestor(resolved, this, false)) return true; // check if it's circular - any symlink above resolves to my target too for (VirtualFileSystemEntry p = getParent(); p != null; p = p.getParent()) { // when the file has no symlinks up the hierarchy, it's not circular if (!p.thisOrParentHaveSymlink()) return false; if (p.isSymlink()) { VirtualFile parentResolved = p.getCanonicalFile(); if (resolved.equals(parentResolved)) { return true; } } } return false; }