Skip to content

Issue #19458: Detect parameter differences in xdocs AST consistency#19461

Open
surajgojanur wants to merge 1 commit into
checkstyle:masterfrom
surajgojanur:issue-19458-xdocs-ast-parameter-consistency
Open

Issue #19458: Detect parameter differences in xdocs AST consistency#19461
surajgojanur wants to merge 1 commit into
checkstyle:masterfrom
surajgojanur:issue-19458-xdocs-ast-parameter-consistency

Conversation

@surajgojanur

@surajgojanur surajgojanur commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #19458

Summary

This PR updates xdocs AST consistency comparison so meaningful token text differences are detected, including method parameter-name differences, while still ignoring comment-only differences.

Details

  • Keeps the xdocs AST consistency mechanism based on live examples.
  • Preserves suppression-based handling for examples intentionally treated as independent.
  • Ensures structural comparison catches real code differences that were previously missed in method parameter identifiers.
  • parametername examples were restored in SUPPRESSED_EXAMPLES because they now correctly register as structural mismatches.

Validation

  • ./mvnw clean -Djacoco.skip=true -Dtest=XdocsExamplesAstConsistencyTest test
  • ./mvnw clean verify

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

Please revert special tests.
Examples are out live tests

}

@Test
public void testParameterNameDifferencesAreDetected() throws CheckstyleException {

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.

We don't need tests, fact that examples are back suppression is good test, live tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed.

I reverted the custom handcrafted tests from XdocsExamplesAstConsistencyTest as requested and kept the actual fix for parameter-difference detection in the AST consistency logic.

The PR now relies on the live examples/suppression behavior as the proof signal.

Validation:

  • ./mvnw clean -Djacoco.skip=true -Dtest=XdocsExamplesAstConsistencyTest test
  • ./mvnw clean verify

Both pass.

@surajgojanur surajgojanur force-pushed the issue-19458-xdocs-ast-parameter-consistency branch from 9628260 to 0385c22 Compare March 25, 2026 18:08

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

Items

boolean compareText) {
this.type = type;
if (ignoreText) {
if (ignoreText || !compareText) {

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.

Refactor to remove compareText from method signature.
ignoreText should be calculated by this ||

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed compareText from the StructuralAstNode constructor and moved the combined ignoreText logic to the call site

@surajgojanur surajgojanur force-pushed the issue-19458-xdocs-ast-parameter-consistency branch 3 times, most recently from 3742289 to c271fb5 Compare March 26, 2026 06:40
@surajgojanur surajgojanur force-pushed the issue-19458-xdocs-ast-parameter-consistency branch from c271fb5 to aab1096 Compare March 26, 2026 07:22
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.

XdocsExamplesAstConsistencyTest does not detect difference in method parameters

2 participants