@Override
  PsiElement migrate(@NotNull Project project, @NotNull PsiElement body, @NotNull TerminalBlock tb) {
    PsiAssignmentExpression assignment = tb.getSingleExpression(PsiAssignmentExpression.class);
    if (assignment == null) return null;
    PsiVariable var = StreamApiMigrationInspection.extractAccumulator(assignment, myReductionOperation.getCompoundAssignmentOp());
    if (var == null) return null;

    CommentTracker ct = new CommentTracker();
    PsiExpression operand = StreamApiMigrationInspection.extractOperand(assignment, myReductionOperation.getCompoundAssignmentOp());
    if (operand == null) return null;
    PsiType type = var.getType();

    PsiType operandType = operand.getType();
    if (operandType != null && !TypeConversionUtil.isAssignable(type, operandType)) {
      operand = JavaPsiFacade.getElementFactory(project).createExpressionFromText(
        "(" + type.getCanonicalText() + ")" + ct.text(operand, ParenthesesUtils.TYPE_CAST_PRECEDENCE), operand);
    }
    JavaCodeStyleManager javaStyle = JavaCodeStyleManager.getInstance(project);
    String leftOperand = javaStyle.suggestUniqueVariableName("a", body, true);
    String rightOperand = javaStyle.suggestUniqueVariableName("b", body, true);

    if(type.equals(PsiTypes.booleanType())) {
      type = PsiTypes.booleanType().getBoxedType(body); // hack to avoid .map(b -> b) when boxing needed
    }

    PsiExpression initializer = var.getInitializer();
    String identity = initializer != null && myReductionOperation.getInitializerExpressionRestriction().test(initializer)
               ? ct.text(initializer)
               : myReductionOperation.getIdentity();
    String stream = tb.add(new StreamApiMigrationInspection.MapOp(operand, tb.getVariable(), type)).generate(ct)
                    + String.format(Locale.ENGLISH, ".reduce(%s, (%s, %s) -> %s %s %s)",
                                    identity, leftOperand, rightOperand, leftOperand,
                                    myReductionOperation.getOperation(), rightOperand);
    return replaceWithOperation(tb.getStreamSourceStatement(), var, stream, type, myReductionOperation, ct);
  }
@Override
  PsiElement migrate(@NotNull Project project, @NotNull PsiElement body, @NotNull TerminalBlock tb)