CanonicalPathMap (@NotNull Set<String> flatWatchRoots, @NotNull Set<String> optimizedRecursiveWatchRoots, @NotNull Collection<Pair<String, String>> pathMappings, boolean convertToForwardSlashes) { NavigableSet<@SystemDependent String> optimizedRecursiveWatchRootsCopy = WatchRootsUtil.createFileNavigableSet(); List<Pair<@SystemDependent String, @SystemDependent String>> initialMappings = new ArrayList<>(pathMappings.size()); // Ensure paths are system dependent if (!convertToForwardSlashes) { optimizedRecursiveWatchRootsCopy.addAll(optimizedRecursiveWatchRoots); initialMappings.addAll(pathMappings); } else { for (String recursiveWatchRoot: optimizedRecursiveWatchRoots) { optimizedRecursiveWatchRootsCopy.add(recursiveWatchRoot.replace('/', '\\')); } for (Pair<String, String> mapping: pathMappings) { initialMappings.add(new Pair<>(mapping.first.replace('/', '\\'), mapping.second.replace('/', '\\'))); } } NavigableSet<@SystemDependent String> optimizedFlatWatchRoots = WatchRootsUtil.optimizeFlatRoots(flatWatchRoots, optimizedRecursiveWatchRootsCopy, convertToForwardSlashes); return new CanonicalPathMap(optimizedRecursiveWatchRootsCopy, optimizedFlatWatchRoots, initialMappings); }