SourceScope (final Module[] modules) { if (modules == null || modules.length == 0) return null; return new ModuleSourceScope(modules[0].getProject()) { @Override public GlobalSearchScope getGlobalSearchScope() { return evaluateScopesAndUnite(modules, module -> module.getModuleRuntimeScope(true)); } @Override public GlobalSearchScope getLibrariesScope() { return evaluateScopesAndUnite(modules, module -> new ModuleWithDependenciesAndLibsDependencies(module)); } @Override public Module[] getModulesToCompile() { return modules; } }; }