private static @NotNull PsiExpression addFieldInitialization(@NotNull PsiMethod constructor,
                                                               LookupElement @NotNull [] suggestedInitializers,
                                                               @NotNull PsiField field,
                                                               @NotNull Project project) {
    PsiCodeBlock methodBody = constructor.getBody();
    if (methodBody == null) {
      //incomplete code
      CreateFromUsageUtils.setupMethodBody(constructor);
      methodBody = constructor.getBody();
      LOG.assertTrue(methodBody != null);
    }

    final String fieldName = field.getName();
    String stmtText = fieldName + " = " + Objects.requireNonNull(suggestedInitializers[0].getPsiElement()).getText() + ";";
    if (methodContainsParameterWithName(constructor, fieldName)) {
      stmtText = "this." + stmtText;
    }

    final PsiManager psiManager = PsiManager.getInstance(project);
    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(psiManager.getProject());
    final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(project);

    final PsiExpressionStatement addedStatement = (PsiExpressionStatement)methodBody.add(codeStyleManager
      .reformat(factory.createStatementFromText(stmtText, methodBody)));
    return Objects.requireNonNull(((PsiAssignmentExpression)addedStatement.getExpression()).getRExpression());
  }
private static @NotNull PsiExpression addFieldInitialization(@NotNull PsiMethod constructor,
                                                               LookupElement @NotNull [] suggestedInitializers,
                                                               @NotNull PsiField field,
                                                               @NotNull Project project)