Skip to content

Issue #18644: Fix SummaryJavadoc forbiddenSummaryFragments for tab-formatted code#18650

Merged
romani merged 1 commit into
checkstyle:masterfrom
pirzada-ahmadfaraz:fix/summary-javadoc-tab-formatted-code
Jan 24, 2026
Merged

Issue #18644: Fix SummaryJavadoc forbiddenSummaryFragments for tab-formatted code#18650
romani merged 1 commit into
checkstyle:masterfrom
pirzada-ahmadfaraz:fix/summary-javadoc-tab-formatted-code

Conversation

@pirzada-ahmadfaraz

Copy link
Copy Markdown
Contributor

Fixes #18644

Summary

The JAVADOC_MULTILINE_TO_SINGLELINE_PATTERN regex in SummaryJavadocCheck only matched spaces before asterisks (\n +(\*)), not tabs. When Javadoc continuation lines used tabs (e.g., \t * text), the pattern failed to match, leaving the asterisk in the processed string.

This caused forbiddenSummaryFragments patterns like ^[a-z] to fail because the string started with * instead of the actual summary text.

Changes

  • Changed the pattern from \n +(\*) to \n[ \t]+(\*) to match both spaces and tabs before the asterisk
  • Added test case with tab-formatted Javadoc to verify the fix

Test

The new test testForbiddenFragmentsTabFormatted verifies that forbiddenSummaryFragments = ^[a-z] correctly detects a violation when the Javadoc summary starts with a lowercase letter in tab-formatted code.

@romani romani 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.

do mvn verify before pushing to github.

public class InputSummaryJavadocForbiddenFragmentsTabFormatted {
// violation below, 'Forbidden summary fragment'
/**
* adds an element to the list.

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.

if there is TAB, it is not visible, use text to hint this.

* this line has tab before asterisk.

@pirzada-ahmadfaraz

Copy link
Copy Markdown
Contributor Author

Hey @romani, I've added a note explaining the tab indentation before the package statement:

// Note: This file uses tab indentation. The Javadoc continuation lines
// have tab characters before the asterisks (e.g., "\t *" not " *").

Let me know if you'd prefer the hint in a different format.

Also, the CI failures seem to be infrastructure-related (Docker build failures, etc.) rather than test failures - the tests pass locally. Could you re-trigger the CI when you get a chance?

@romani

romani commented Jan 17, 2026

Copy link
Copy Markdown
Member

not and infra problems.

Please read and watch videos at Starting_Development.
Please make CI green. watch all videos, they explains how to investigate CI failures.

@pirzada-ahmadfaraz pirzada-ahmadfaraz force-pushed the fix/summary-javadoc-tab-formatted-code branch 2 times, most recently from d774470 to 21e7047 Compare January 18, 2026 10:11
@pirzada-ahmadfaraz pirzada-ahmadfaraz force-pushed the fix/summary-javadoc-tab-formatted-code branch from 21e7047 to 5dd6af7 Compare January 18, 2026 11:16
@pirzada-ahmadfaraz

Copy link
Copy Markdown
Contributor Author

@romani all good?

@romani

romani commented Jan 18, 2026

Copy link
Copy Markdown
Member

Github, generate report for SummaryJavadoc/all-examples-in-one

@github-actions

Copy link
Copy Markdown
Contributor

@pirzada-ahmadfaraz

Copy link
Copy Markdown
Contributor Author

@romani updates on this?

@romani romani 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.

thanks a lot !!!

The
Google Java Style Guide explicitly mandates not using tab characters for indentation.
so it will not affect google style, even in diff report we see violations on "this method returns" (that is google style forbidden wording)

@romani

romani commented Jan 24, 2026

Copy link
Copy Markdown
Member

@pirzada-ahmadfaraz , in next PR please trigger this diff report your self and write comment to explicitly state that you reviewed all in it and all is valid changes.

it will speed up PR acceptance, see you in other PR.
Thanks a lot for your help.

@romani romani merged commit e36dc4d into checkstyle:master Jan 24, 2026
119 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False-negative: SummaryJavadoc:forbiddenSummaryFragments for tab-formatted code

2 participants