@Override
  protected LocalQuickFix @NotNull [] buildFixes(Object... infos) {
    PsiExpression expression = ObjectUtils.tryCast(ArrayUtil.getFirstElement(infos), PsiExpression.class);
    PsiVariable var = getAppendedVariable(expression);
    if (var == null) return InspectionGadgetsFix.EMPTY_ARRAY;
    boolean needNullSafe = canBeNull(var);
    List<LocalQuickFix> fixes = new ArrayList<>();
    if (var instanceof PsiLocalVariable) {
      fixes.add(new ReplaceWithStringBuilderFix(var, false));
      if (needNullSafe) {
        fixes.add(new ReplaceWithStringBuilderFix(var, true));
      }
      PsiLoopStatement loop = getOutermostCommonLoop(expression, var);
      // Do not add IntroduceStringBuilderFix if there's only 0 or 1 reference to the variable outside loop:
      // in this case the result is usually similar to ReplaceWithStringBuilderFix or worse
      if (VariableAccessUtils.getVariableReferences(var).stream()
            .filter(e -> !PsiTreeUtil.isAncestor(loop, e, true))
            .limit(2).count() > 1) {
        fixes.add(new IntroduceStringBuilderFix(var, false));
        if (needNullSafe) {
          fixes.add(new IntroduceStringBuilderFix(var, true));
        }
      }
    }
    else if (var instanceof PsiParameter) {
      fixes.add(new IntroduceStringBuilderFix(var, false));
      if (needNullSafe) {
        fixes.add(new IntroduceStringBuilderFix(var, true));
      }
    }
    return fixes.toArray(LocalQuickFix.EMPTY_ARRAY);
  }
@Override
  protected LocalQuickFix @NotNull [] buildFixes(Object... infos)