private @NotNull Map<VirtualFile, @Nls String> calculateModules(@NotNull List<? extends VirtualFile> roots) {
    Map<VirtualFile, @Nls String> result = new HashMap<>();

    final ModuleManager moduleManager = ModuleManager.getInstance(myProject);
    // assertion for read access inside
    Module[] modules = ReadAction.compute(() -> moduleManager.getModules());

    TreeSet<VirtualFile> checkSet = new TreeSet<>(FilePathComparator.getInstance());
    checkSet.addAll(roots);
    for (Module module : modules) {
      if (ModuleType.isInternal(module)) continue;
      VirtualFile[] files = ModuleRootManager.getInstance(module).getContentRoots();
      for (VirtualFile file : files) {
        VirtualFile floor = checkSet.floor(file);
        if (floor != null) {
          result.put(file, module.getName());
        }
      }
    }
    return result;
  }
private @NotNull Map<VirtualFile, @Nls String> calculateModules(@NotNull List<? extends VirtualFile> roots)