PsiAnnotation (Project project, String qualifiedName) { JavaPsiFacade facade = JavaPsiFacade.getInstance(project); GlobalSearchScope allScope = GlobalSearchScope.allScope(project); if (facade.findClass(qualifiedName, allScope) != null) { return facade.getElementFactory().createAnnotationFromText("@" + qualifiedName, null); } return null; }