private void generateJavaDocForDocumentedFields(@NotNull PsiClass record) {
    Map<String, String> comments = new LinkedHashMap<>();
    for (PsiField field : myRecordCandidate.getFieldAccessors().keySet()) {
      StringBuilder fieldComment = new StringBuilder();
      for (PsiComment comment : ObjectUtils.notNull(PsiTreeUtil.getChildrenOfType(field, PsiComment.class), new PsiComment[0])) {
        if (comment instanceof PsiDocComment) {
          Arrays.stream(((PsiDocComment)comment).getDescriptionElements()).map(PsiElement::getText).forEach(fieldComment::append);
          continue;
        }
        String commentText = comment.getText();
        String unwrappedText = comment.getTokenType() == JavaTokenType.END_OF_LINE_COMMENT
                               ? StringUtil.trimStart(commentText, "//")
                               : StringUtil.trimEnd(commentText.substring(2), "*/");
        fieldComment.append(unwrappedText);
      }
      if (!fieldComment.isEmpty()) {
        comments.put(field.getName(), fieldComment.toString());
      }
    }
    if (comments.isEmpty()) return;
    PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(myProject).getParserFacade();
    PsiDocComment recordDoc = record.getDocComment();
    if (recordDoc == null) {
      PsiDocComment emptyDoc = parserFacade.createDocCommentFromText("/** */");
      recordDoc = (PsiDocComment)record.addBefore(emptyDoc, record.getFirstChild());
    }
    for (var entry : comments.entrySet()) {
      String paramName = entry.getKey();
      String paramComment = entry.getValue();
      PsiDocTag docTag = parserFacade.createDocTagFromText("@param " + paramName + " " + paramComment);
      recordDoc.add(docTag);
    }
  }
private void generateJavaDocForDocumentedFields(@NotNull PsiClass record)