PsiType (Project project, Key<PsiType> key, String text) { final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); PsiType type = project.getUserData(key); if (type == null) { type = factory.createTypeFromText(text, null); project.putUserData(key, type); } return type; }