void (@NotNull PsiExpression expression, @NotNull String newExpression, CommentTracker tracker) { PsiExpression expressionToReplace = expression; final String expString; if (BoolUtils.isNegated(expression)) { expressionToReplace = BoolUtils.findNegation(expressionToReplace); expString = newExpression; } else { PsiElement parent = expressionToReplace.getParent(); while (parent instanceof PsiParenthesizedExpression) { expressionToReplace = (PsiExpression)parent; parent = parent.getParent(); } expString = "!(" + newExpression + ')'; } assert expressionToReplace != null; replaceExpression(expressionToReplace, expString, tracker); }