Collection<PsiJavaModule> (@NotNull String moduleName, @NotNull GlobalSearchScope scope) { JavaFileManager javaFileManager = JavaFileManager.getInstance(myProject); return CachedValuesManager.getManager(myProject) .getCachedValue(myProject, () -> { Map<GlobalSearchScope, Map<String, Collection<PsiJavaModule>>> scope2ModulesMap = ConcurrentFactoryMap.create(searchScope -> ConcurrentFactoryMap.create(name -> javaFileManager.findModules(name, searchScope), () -> CollectionFactory.createConcurrentWeakValueMap()), () -> ContainerUtil.createConcurrentSoftKeySoftValueMap()); return new CachedValueProvider.Result<>(scope2ModulesMap, PsiJavaModuleModificationTracker.getInstance(myProject), ProjectRootModificationTracker.getInstance(myProject)); }) .get(scope) .get(moduleName); }