PsiClass (@NotNull String text) { JavaDummyElement dummyElement = new JavaDummyElement(text, DECLARATION, LanguageLevel.JDK_16); DummyHolder holder = DummyHolderFactory.createHolder(myManager, dummyElement, null); PsiElement element = SourceTreeToPsiMap.treeElementToPsi(holder.getTreeElement().getFirstChildNode()); if (!(element instanceof PsiClass)) { throw newException("Incorrect class '" + text + "'", holder); } return (PsiClass)element; }