JavadocTypeCheck incorrectly matches record component @param tags using prefix instead of exact match (original) (raw)
I noticed that the Javadoc check does not correctly validate @param tags for record components.
Currently, it treats a tag as valid if it shares a prefix with the component name, instead of requiring an exact match. This leads to inconsistent validation results.
Steps to reproduce
- Create a file with the following content:
/**
- Example case
- @param john123 wrong tag for a different component */ record Sample(String john) {}
- Use the following Checkstyle configuration:
- Run Checkstyle:
checkstyle -c checkstyle.xml Sample.java
Expected behavior
@paramtags should match the record component name exactly- A missing
@param johnviolation should be reported
Actual behavior
@param john123is treated as documentingjohndue to prefix-based matching- Missing
@param johnis not reported john123is still flagged as an unused tag
Why this is a problem
This creates inconsistent behavior:
- The incorrect tag is accepted in one place
- But rejected in another
This makes the validation confusing and unreliable.