PsiElement (@NotNull PsiElement psiElement, @NotNull TreeElement treeElement, @NotNull PsiElement newElement) { CompositeElement treeParent = treeElement.getTreeParent(); LOG.assertTrue(treeParent != null); CheckUtil.checkWritable(psiElement); TreeElement elementCopy = ChangeUtil.copyToElement(newElement); treeParent.replaceChildInternal(treeElement, elementCopy); elementCopy = ChangeUtil.decodeInformation(elementCopy); return SourceTreeToPsiMap.treeElementToPsi(elementCopy); }