PsiPackage (Project project, final PsiMigration migration, final String qName) { PsiPackage aPackage = JavaPsiFacade.getInstance(project).findPackage(qName); if (aPackage != null) { return aPackage; } else { return WriteAction.compute(() -> migration.createPackage(qName)); } }