List<PsiClass> (@NotNull PsiPackage pkg, boolean withInnerClasses, @NotNull GlobalSearchScope scope) { ProgressManager.checkCanceled(); return ReadAction.compute(() -> { List<PsiClass> classes = new ArrayList<>(); for (PsiClass clazz : pkg.getClasses(scope)) { classes.add(clazz); if (withInnerClasses) { classes.addAll(new SmartList<>(clazz.getAllInnerClasses())); } } for (PsiPackage subPkg : pkg.getSubPackages(scope)) { classes.addAll(getClasses(subPkg, withInnerClasses, scope)); } return classes; }); }