PsiPrefixExpression (PsiExpression otherOperand) { PsiPrefixExpression expression = (PsiPrefixExpression)createExpression(otherOperand.getManager(), "!(xxx)"); assert expression != null; PsiExpression operand = expression.getOperand(); assert operand != null; try { operand.replace(otherOperand); } catch (IncorrectOperationException e) { LOG.error(e); } return expression; }