boolean (@NotNull PsiPackage p, int packageNameOccurrencesFound) { final PsiPackage[] subPackages = p.getSubPackages(); packageNameOccurrencesFound += subPackages.length; if (packageNameOccurrencesFound > SUBPACKAGE_LIMIT) { return true; } for (PsiPackage subPackage : subPackages) { if (scanPackages(subPackage, packageNameOccurrencesFound)) { return true; } } return false; }