void (@NotNull Module module, @NotNull Set<? super Module> modules) { if (modules.contains(module)) return; modules.add(module); Module[] dependencies = ModuleRootManager.getInstance(module).getDependencies(); for (Module dependency : dependencies) { getDependencies(dependency, modules); } }