void (@Nullable String type) { if (StringUtil.isEmpty(type)) { return; } final Substring typeSub = myOriginalDocString.getReturnTypeSubstring(); if (typeSub != null) { replace(typeSub.getTextRange(), type); return; } final Section returnSection = findFirstReturnSection(); if (returnSection != null) { final List<SectionField> fields = returnSection.getFields(); if (!fields.isEmpty()) { final SectionField firstField = fields.get(0); final String newLine = createReturnLine(type, getSectionIndent(returnSection), getFieldIndent(returnSection, firstField)); insertBeforeLine(getFieldStartLine(firstField), newLine); } else { final String newLine = createReturnLine(type, getSectionIndent(returnSection), getExpectedFieldIndent()); insertAfterLine(getSectionTitleLastLine(returnSection), newLine); } } else { final SectionBasedDocStringBuilder builder = createBuilder() .withSectionIndent(getExpectedFieldIndent()) .startReturnsSection() .addReturnValue(null, type, ""); insertNewSection(builder, SectionBasedDocString.RETURNS_SECTION); } }