private static List<VirtualFile> getPotentialRoots(Module module, PsiDirectory[] dirs) {
    if (dirs.length != 0) {
      return StreamEx.of(dirs).map(PsiDirectory::getParentDirectory).nonNull().map(PsiDirectory::getVirtualFile).toList();
    }
    else {
      ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
      List<VirtualFile> resourceRoots = rootManager.getSourceRoots(JavaResourceRootType.RESOURCE);
      if (!resourceRoots.isEmpty()) {
        return resourceRoots;
      }
      return rootManager.getSourceRoots(JavaModuleSourceRootTypes.SOURCES);
    }
  }
private static List<VirtualFile> getPotentialRoots(Module module, PsiDirectory[] dirs)