private void addParentContentRootModules(HashSet<Module> modules) {
    var parentContentRootModules = new HashSet<Module>();
    for (Module module : modules) {
      for (VirtualFile contentRoot : ModuleRootManager.getInstance(module).getContentRoots()) {
        var parentContentRoot = contentRoot.getParent();
        if (parentContentRoot == null) {
          continue;
        }
        parentContentRootModules.addAll(getModulesByFile(parentContentRoot));
      }
    }
    // Account for a crazy case where a module's content root is under another content root of the same module,
    // or another module that's already collected. Otherwise, we may end up recursing infinitely here.
    parentContentRootModules.removeAll(modules);
    if (parentContentRootModules.isEmpty()) {
      return;
    }
    modules.addAll(parentContentRootModules);
    // Now add parents' parents.
    addParentContentRootModules(parentContentRootModules);
  }
private void addParentContentRootModules(HashSet<Module> modules)