Convert Javadoc comments to the /// Markdown style - #19126
Merged
yashmayya merged 1 commit intoJul 30, 2026
Merged
Conversation
yashmayya
force-pushed
the
worktree/javadoc-to-markdown-comments-cc6c9a
branch
from
July 30, 2026 04:16
6c476ed to
c60d92d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19126 +/- ##
============================================
- Coverage 65.60% 65.59% -0.02%
Complexity 1423 1423
============================================
Files 3450 3439 -11
Lines 218378 218147 -231
Branches 34670 34650 -20
============================================
- Hits 143275 143084 -191
+ Misses 63538 63506 -32
+ Partials 11565 11557 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
xiangfu0
approved these changes
Jul 30, 2026
Contributor
|
can we also add a checkstyle rule for this ? |
Contributor
Author
A naive one would flag all the ASF license headers, let me check if its possible to add a more sophisticated one. Edit: added a regex based checkstyle rule - verified that there's no false positives right now, and that it does actually catch new additions of /** style Javadocs. |
yashmayya
force-pushed
the
worktree/javadoc-to-markdown-comments-cc6c9a
branch
from
July 30, 2026 15:51
c60d92d to
bcd6d0d
Compare
yashmayya
force-pushed
the
worktree/javadoc-to-markdown-comments-cc6c9a
branch
from
July 30, 2026 16:02
bcd6d0d to
58610fa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Converts every Javadoc comment in the repo to the JEP 467 Markdown doc comment style (
///), and replaces the raw HTML and{@link}/{@code}inline tags inside them with native Markdown.Why
///is already the dominant style for new code here (~2,500 files used it before this change), so the codebase had two competing Javadoc styles side by side. This finishes the migration so there is exactly one.Beyond consistency, a lot of the old
/** */Javadoc was quietly rendering wrong, and converting it surfaced and fixed that:- itembullets, which HTML Javadoc flattened into a single run-on paragraph. They now render as actual lists (~250 comments).`someMethod()`expecting code formatting and got the backtick characters instead. These are now real code spans (~60 comments).<and&in prose that Javadoc flagged as errors. Text likewatermarkMs <= 0orstart & end timerendered as a conspicuousinvalid input: '<'marker in the generated docs. Those are gone (~67 comments).<table>markup is now GFM tables, which additionally get proper<thead>/<tbody>.The
///form is also simply easier to read and edit — no leading-asterisk column to maintain, and no HTML tags interleaved with prose.What changed
Comment text only. The single non-comment change is the removal of 143
importstatements (details below)./** ... *////{@link R},{@link R#m()}[R],[R#m()]{@link R label}[`label`][R]{@code X},<code>X</code>`X`<b>/<strong>,<i>/<em>**x**,_x_<a href="U">T</a>[T](U)<ul>/<ol>+<li>-/1.lists<pre>{@code ...}</pre><table><p>The ASF license header at the top of every file is deliberately left as
/** */.A Checkstyle rule is added in
config/checkstyle.xmlso the codebase does not drift back:It reports zero violations across the converted tree, and fails the build with that message the
moment a new
/** */doc comment is introduced. It deliberately does not match the ASF licenseheader (matched by its text rather than its position, since a few files place it below the
imports),
/*** ... ***/decorative separators, or a/**appearing mid-line inside a stringliteral. Generated sources are already covered by the existing entries in
config/suppressions.xml, so they need no special handling.Verification
Every mapping above was confirmed by rendering it with the JDK 25
javadoctool and diffing the generated HTML, rather than assumed.{@link R}→[R]and{@code X}→`X`produce byte-identical output;<b>→<strong>and<i>→<em>are the only tag substitutions, and are visually identical.To check the change end to end, all 15,025 doc comments were rendered twice — once from the original
/** */source and once from the converted Markdown — and the resulting HTML compared. 692 comments (4.6%) render differently, and they break down as:invalid inputmarkers).##reproduces the old<h3>exactly in class-level docs; in member docs the heading renders a level or two smaller.<br>tags that became paragraph breaks. Markdown has no whitespace-safe hard line break (the CommonMark\form renders literally in Javadoc), so this one is unavoidable.Also verified:
mvn test-compilepasses — 84 modules, 0 errors — along withspotless:checkandlicense:check.and a deliberately reintroduced
/** */comment fails the build as expected.masterconfirms no code changed anywhere except the import removals below.Import removals
Checkstyle's
UnusedImportsonly parses/** */comments, so an import referenced solely from a{@link}inside a///comment is reported as unused. For those 143 cases the reference was rewritten to its fully-qualified form and the import dropped. This does not affect rendered output — Javadoc renders a reference as its simple name whether or not it is written fully qualified. Worth flagging as a follow-up: if a future Checkstyle release understands Markdown doc comments, these can go back to simple names plus imports.Two places where raw HTML remains
Both are cases Markdown cannot express:
<a href="...">, which is the only form that fits.Other notes for reviewers
/*** banner ***/separators are left as block comments. Javadoc technically treats them as doc comments, but they are decorative section dividers, not documentation.pinot-common/src/main/java/org/apache/pinot/common/request/and the Thrift test fixtures are excluded — they are regenerated from.thriftsources and are already listed inconfig/suppressions.xml.*,_,[,]in text like__name__or[column_name]) are escaped so they keep rendering literally.{@inheritDoc},{@value}, and{@literal}are left alone, as they have no Markdown equivalent.One behavioural change worth calling out:
JavadocStyleandMissingOverrideinconfig/checkstyle.xmlonly inspect/** */comments, so this migration retires those two checks in practice. Both are anchored on the block-comment form and would need updating (or a Checkstyle upgrade) to apply to///.JavadocStylemostly guarded against malformed HTML, which matters far less now that the comments are Markdown;MissingOverrideis the more useful of the two and is worth a follow-up.