boolean (List<VFileEvent> events, NewVirtualFileSystem fs, VirtualDirectoryImpl dir) { var t = System.nanoTime(); Pair<List<VirtualFile>, List<String>> snapshot = ReadAction.compute(() -> new Pair<>(dir.getCachedChildren(), dir.getSuspiciousNames())); myVfsTime.addAndGet(System.nanoTime() - t); List<VirtualFile> cached = snapshot.first; List<String> wanted = snapshot.second; Map<String, FileAttributes> dirList = null; if (fs instanceof BatchingFileSystem) { Set<String> names = CollectionFactory.createFilePathSet(wanted, dir.isCaseSensitive()); for (VirtualFile file : cached) { names.add(file.getName()); } t = System.nanoTime(); Map<String, FileAttributes> rawDirList = ((BatchingFileSystem)fs).listWithAttributes(dir, names); myIoTime.addAndGet(System.nanoTime() - t); dirList = adjustCaseSensitivity(rawDirList, dir.isCaseSensitive()); } ObjectOpenCustomHashSet<String> actualNames; if (dir.isCaseSensitive() || cached.isEmpty()) { actualNames = null; } else if (dirList != null) { actualNames = (ObjectOpenCustomHashSet<String>)CollectionFactory.createFilePathSet(dirList.keySet(), false); } else { t = System.nanoTime(); String[] rawList = fs instanceof LocalFileSystemImpl ? ((LocalFileSystemImpl)fs).listWithCaching(dir) : fs.list(dir); actualNames = (ObjectOpenCustomHashSet<String>)CollectionFactory.createFilePathSet(rawList, false); myIoTime.addAndGet(System.nanoTime() - t); } if (LOG.isTraceEnabled()) { LOG.trace("cached=" + cached + " actual=" + actualNames + " suspicious=" + wanted); } List<ChildInfo> newKids = wanted.isEmpty() ? List.of() : new ArrayList<>(wanted.size()); for (String newName : wanted) { if (VfsUtil.isBadName(newName)) continue; FakeVirtualFile child = new FakeVirtualFile(dir, newName); FileAttributes attributes = getAttributes(fs, dirList, child); if (attributes != null) { newKids.add(childRecord(fs, child, attributes, true)); } } List<Pair<VirtualFile, FileAttributes>> existingMap = cached.isEmpty() ? List.of() : new ArrayList<>(cached.size()); for (VirtualFile child : cached) { existingMap.add(new Pair<>(child, getAttributes(fs, dirList, child))); } clearFsCache(fs); checkCancelled(dir); if (isDirectoryChanged(dir, cached, wanted)) { return false; } generateCreateEvents(events, dir, newKids); generateUpdateEvents(events, fs, dir, actualNames, existingMap); checkCancelled(dir); return !isDirectoryChanged(dir, cached, wanted); }