SONARJAVA-6825: Implemented rule S9360 - Javadoc references should point to existing types - #6005
SONARJAVA-6825: Implemented rule S9360 - Javadoc references should point to existing types#6005romainbrenguier wants to merge 13 commits into
Conversation
…int to existing types
This comment has been minimized.
This comment has been minimized.
|
❌ Ruling needs updating. A fix PR has been created: #6006 Please review and merge it into your branch. |
…aselines
- Fix dead code in resolveReference(): remove tautological guard that
prevented relative (same-package) reference resolution
- Fix package name extraction: use ExpressionsHelper.concatenate()
instead of unreliable PackageDeclarationTree.toString()
- Fix SEE_ANCHOR_PATTERN: match {@link}/{@linkplain} instead of
invalid {@see} inline syntax
- Refactor visitTrivia loop to reduce break/continue (S135 fix)
- Add unit tests for extractSeeReferences and resolveReference methods
- Add test cases for {@link}, {@linkplain}, simple name references
- Add LITS ruling baselines for S9360
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ruling Diff SummaryDetected changes in 6 rule files: 0 issues removed, 414 issues added. S9360 (
|
|
❌ Ruling needs updating. A fix PR has been created: #6006 Please review and merge it into your branch. |
…erences - Resolve unqualified @see/@link names against imports and java.lang before flagging them as invalid. Previously, simple names like `@see List` or `@see String` were incorrectly prepended with the current package name, producing false positives. - Remove dead-code null/empty guards in extractSeeReferences() and resolveReference() flagged by S2589. - Refactor resolveReference into stripMemberReference + isUnresolvableReference for clearer separation of concerns. - Add compliant test cases for imported types, java.lang types, and same-package class references. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🤖 Generated with GitHub Actions
|
❌ Ruling needs updating. A fix PR has been created: #6006 Please review and merge it into your branch. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
❌ Ruling needs updating. A fix PR has been created: #6013 Please review and merge it into your branch. |
…line - Fix false positives for inner/nested type references by collecting declared types from the compilation unit - Fix false positives for dotted inner class references (e.g., Map.Entry) by trying $ notation with imports and package prefix - Filter out HTML anchor @see tags (e.g., @see <a href="...">) - Filter out quoted string @see tags (e.g., @see "text") - Add missing ruling baseline for eclipse-jetty-similar-to-main Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
❌ Ruling needs updating. A fix PR has been created: #6015 Please review and merge it into your branch. |
…ndling - Remove dead-code condition in setContext (S2589: getTree() is non-null) - Hoist Tree.Kind[] allocation to static final constant - Fix multi-level nested inner class resolution (e.g., Outer.Inner.Deep) - Convert skip tests to parameterized test (S5976) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🤖 Generated with GitHub Actions
|
❌ Ruling needs updating. A fix PR has been created: #6017 Please review and merge it into your branch. |
…for S9360 Remove false positives from the ruling baseline that were eliminated by the improved import resolution and inner class handling in S9360. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-rule-s9360-sonarjava-6825' into romain/new-rule-s9360-sonarjava-6825
|
❌ Ruling needs updating. A fix PR has been created: #6017 Please review and merge it into your branch. |
Code Review ✅ Approved 5 resolved / 5 findingsImplements rule S9360 to detect Javadoc references pointing to non-existent types, addressing dead code, false positives on simple names and nested inner classes, and allocation inefficiencies. ✅ 5 resolved✅ Bug: Relative @see reference resolution is dead code
✅ Bug: SEE_ANCHOR_PATTERN matches
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
|
|
This implements the wrong rule |




Summary
Key features
Test plan