void (PsiPackage psiPackage, Module module, TodoTreeBuilder builder, Project project, Set<? super PsiPackage> packages) { if (!isPackageEmpty(new PackageElement(module, psiPackage, false), builder, project)){ packages.add(psiPackage); } GlobalSearchScope scope = module != null ? GlobalSearchScope.moduleScope(module) : GlobalSearchScope.projectScope(project); final PsiPackage[] subPackages = psiPackage.getSubPackages(scope); for (PsiPackage subPackage : subPackages) { traverseSubPackages(subPackage, module, builder, project, packages); } }