private static @NotNull Map<VirtualFile, @NlsSafe String> buildMappingShortNameMap(@NotNull Project project,
                                                                                     @NotNull List<MappedRoot> roots) {
    String basePath = project.getBasePath();
    String builderRoot = basePath != null ? FileUtil.toSystemIndependentName(basePath) : "";

    MultiMap<String, VirtualFile> nameCollisionMap = new MultiMap<>();
    for (MappedRoot mappedRoot : roots) {
      VirtualFile root = mappedRoot.root;
      nameCollisionMap.putValue(root.getName(), root);
    }

    Map<VirtualFile, @NlsSafe String> result = new HashMap<>();
    for (Map.Entry<String, Collection<VirtualFile>> entry : nameCollisionMap.entrySet()) {
      Collection<VirtualFile> collisionRoots = entry.getValue();
      if (collisionRoots.size() == 1) {
        // UniqueNameBuilder doesn't support unique names
        for (VirtualFile root : collisionRoots) {
          result.put(root, root.getName());
        }
      }
      else {
        UniqueNameBuilder<VirtualFile> builder = new UniqueNameBuilder<>(builderRoot, File.separator);
        for (VirtualFile root : collisionRoots) {
          builder.addPath(root, root.getPath());
        }
        for (VirtualFile root : collisionRoots) {
          result.put(root, StringUtil.nullize(builder.getShortPath(root)));
        }
      }
    }
    return result;
  }
private static @NotNull Map<VirtualFile, @NlsSafe String> buildMappingShortNameMap(@NotNull Project project,
                                                                                     @NotNull List<MappedRoot> roots)