Skip to content

Add missing Javadoc paragraph tags#931

Open
pratheeknaidu wants to merge 4 commits into
openrewrite:mainfrom
pratheeknaidu:javadoc-paragraph
Open

Add missing Javadoc paragraph tags#931
pratheeknaidu wants to merge 4 commits into
openrewrite:mainfrom
pratheeknaidu:javadoc-paragraph

Conversation

@pratheeknaidu

@pratheeknaidu pratheeknaidu commented Jul 1, 2026

Copy link
Copy Markdown

Summary

  • add a JavadocParagraph recipe that inserts missing <p> tags after blank Javadoc lines
  • preserve first paragraphs, existing <p> tags, block-tag sections, whitespace, and line endings
  • cover multiple paragraphs, inline markup, CRLF, block tags, and unchanged cases

Testing

timtebeek added 3 commits July 1, 2026 10:53
- Remove redundant changed flag since withBody is idempotent
- Skip injecting <p> before block-level HTML elements and inside <pre>
DocComment.withBody uses reference equality (this.body == body), so
returning a freshly-built list unconditionally reports a change on every
cycle. Restore the guard that returns the original DocComment when no <p>
was inserted, matching the RemoveJavaDocAuthorTag idiom.

Add regression tests confirming <p> is not injected before block-level
HTML nor inside <pre> blocks, and that prose after a </pre> is still tagged.
flatMap returns the original list reference when no element changes, so
withBody's identity check makes the visitor idempotent without a changed
flag; the flatMap 1-to-many mapping covers the <p>-insertion case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants