@Nullable
  PsiDirectory getRootDir() {
    if (myModule == null) return null;
    return ReadAction.compute(() -> {
      ModuleRootManager moduleManager = ModuleRootManager.getInstance(myModule);
      List<VirtualFile> folderCandidates = new ArrayList<>();
      for (ContentEntry entry : moduleManager.getContentEntries()) {
        for (SourceFolder folder : entry.getSourceFolders()) {
          if (isSourceFolder(folder)) {
            folderCandidates.add(folder.getFile());
          }
        }
      }

      PsiManager psiManager = PsiManager.getInstance(myModule.getProject());
      return folderCandidates.stream()
        .filter(Objects::nonNull)
        .sorted(Comparator.comparingInt((VirtualFile vFile) -> "java".equals(vFile.getName()) ? 0 : 1).thenComparing(VirtualFile::getName))
        .map(psiManager::findDirectory)
        .filter(Objects::nonNull).findFirst().orElse(null);
    });
  }
@Nullable
  PsiDirectory getRootDir()