Skip to content

Fix JavadocAlignParameterDescriptionCheck with inline tags - #14427

Merged
Warriorrrr merged 2 commits into
PaperMC:mainfrom
Kukzze:fix/javadoc-align-link-tags
Oct 27, 2026
Merged

Warriorrrr merged 2 commits into
PaperMC:mainfrom
Kukzze:fix/javadoc-align-link-tags

Conversation

@Kukzze

@Kukzze Kukzze commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Resolves #14405

Problem

When a parameter description contains inline tags (such as {@link ...}), Checkstyle produces multiple \TEXT\ tokens on the same line (the text preceding the tag and the text trailing the tag). \JavadocAlignParameterDescriptionCheck\ was evaluating all text nodes indiscriminately, causing trailing tokens on the same line (which start at column 70+) to be treated as separate description lines. This artificially inflated \maxColumn\ and caused false-positive alignment violations across the entire block.

Solution

Track visited line numbers so that only the first \TEXT\ node on each distinct line is evaluated for parameter description column alignment. Subsequent text tokens on the same line are ignored for indentation purposes.

Includes the test case provided by @Warriorrrr in #14405.

@Kukzze
Kukzze requested a review from a team as a code owner October 27, 2026 05:29
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Oct 27, 2026
@Machine-Maker

Copy link
Copy Markdown
Member

Do we also have a problem if a 2nd, or 3rd line in a parameter description starts with an {@link tag (or some other tag)? In that case, doesn't the text block start at a column position further away?

@Kukzze

Kukzze commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Nope, Checkstyle parses the leading indentation before {@link as a TEXT node with whitespace. SPACE_PREFIX matches those spaces to calculate the correct column, and visitedLines skips the trailing text after the tag.

Added a test case for this in the latest commit as well.

@Doc94 Doc94 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the tests based in issue seems fine to include.

@papermc-projects papermc-projects Bot moved this from Awaiting review to Delayed approval in Paper PR Queue Oct 27, 2026
@papermc-projects papermc-projects Bot moved this from Delayed approval to Full approval in Paper PR Queue Oct 27, 2026
@Warriorrrr
Warriorrrr merged commit 9d95051 into PaperMC:main Oct 27, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Full approval to Merged in Paper PR Queue Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Merged

Development

Successfully merging this pull request may close these issues.

[Checkstyle] Javadoc parameter alignment check does not work with inlined tags

4 participants