PsiClass[] (Project project, final PsiMigration migration, final String qName) { PsiClass[] classes = JavaPsiFacade.getInstance(project).findClasses(qName, GlobalSearchScope.allScope(project)); if (classes.length == 0) { classes = WriteAction.compute(() -> new PsiClass[] {migration.createClass(qName)}); } return classes; }