ResourceBundleWithCachedFiles (@NotNull final String baseName, @Nullable final String extension, @NotNull final PsiDirectory baseDirectory) { final ResourceBundleManager bundleBaseNameManager = ResourceBundleManager.getInstance(baseDirectory.getProject()); final List<PropertiesFile> bundleFiles = Stream .of(baseDirectory.isValid() ? baseDirectory.getFiles() : PsiFile.EMPTY_ARRAY) .filter(f -> isPropertiesFile(f) && Comparing.strEqual(f.getVirtualFile().getExtension(), extension) && Objects.equals(bundleBaseNameManager.getBaseName(f), baseName)) .map(PropertiesImplUtil::getPropertiesFile) .collect(Collectors.toList()); if (bundleFiles.isEmpty()) return null; return new ResourceBundleWithCachedFiles(new ResourceBundleImpl(bundleFiles.get(0)), bundleFiles); }