private static void findFiles(@NotNull Module module, @NotNull List<? super PsiFile> files) {
    final ModuleFileIndex idx = ModuleRootManager.getInstance(module).getFileIndex();

    final VirtualFile[] roots = ModuleRootManager.getInstance(module).getContentRoots();

    for (final VirtualFile root : roots) {
      ApplicationManager.getApplication().runReadAction(() -> {
        idx.iterateContentUnderDirectory(root, dir -> {
          if (dir.isDirectory()) {
            final PsiDirectory psiDir = PsiManager.getInstance(module.getProject()).findDirectory(dir);
            if (psiDir != null) {
              findFiles(files, psiDir, false);
            }
          }
          return true;
        });
      });
    }
  }
private static void findFiles(@NotNull Module module, @NotNull List<? super PsiFile> files)