void (PsiDirectory directory, Condition<? super PsiClass> acceptAsTest, Set<Location<?>> classes) { PsiDirectory[] subDirectories = ReadAction.compute(() -> directory.getSubdirectories()); for (PsiDirectory subDirectory : subDirectories) { collectClassesRecursively(subDirectory, acceptAsTest, classes); } PsiFile[] files = ReadAction.compute(() -> directory.getFiles()); for (PsiFile file : files) { if (file instanceof PsiClassOwner) { for (PsiClass aClass : ReadAction.compute(() -> ((PsiClassOwner)file).getClasses())) { collectInnerClasses(aClass, acceptAsTest, classes); } } } }