void (@NotNull Project project, @NotNull PsiMethodCallExpression call) { PsiElement parent = PsiTreeUtil.getParentOfType(call, PsiIfStatement.class, PsiPolyadicExpression.class); if (parent == null) return; CommentTracker ct = new CommentTracker(); if (parent instanceof PsiPolyadicExpression conjunction) { PsiExpression[] conjuncts = conjunction.getOperands(); if (conjuncts.length == 2) { ct.replaceAndRestoreComments(parent, conjuncts[0]); } else { PsiExpression lastConjunct = conjuncts[conjuncts.length-1]; PsiJavaToken token = conjunction.getTokenBeforeOperand(lastConjunct); if (token != null) { ct.delete(token); } ct.deleteAndRestoreComments(lastConjunct); } } else { PsiIfStatement ifStatement = (PsiIfStatement)parent; PsiExpressionStatement thenBody = tryCast(ControlFlowUtils.stripBraces(ifStatement.getThenBranch()), PsiExpressionStatement.class); if (thenBody == null) return; ct.replaceAndRestoreComments(ifStatement, thenBody); } }