Skip to content

SONARJAVA-6048 Recognize qualified Deprecated annotations - #6499

Draft
romainbrenguier wants to merge 2 commits into
masterfrom
fix/romainbrenguier/SONARJAVA-6048-qualifiedDeprecated
Draft

romainbrenguier wants to merge 2 commits into
masterfrom
fix/romainbrenguier/SONARJAVA-6048-qualifiedDeprecated

Conversation

@romainbrenguier

Copy link
Copy Markdown
Contributor

SONARJAVA-6048 — https://sonarsource.atlassian.net/browse/SONARJAVA-6048

Human description

S1123 now recognizes @java.lang.Deprecated when the declaration also has an @deprecated Javadoc tag. This removes incorrect missing-annotation reports, including those on protobuf-style enum methods.

Declarations that lack the Javadoc tag still produce the valid missing-tag report. Short-form annotation detection stays unchanged.

Agent description

Approach and acceptance coverage

Keep the identifier branch and check the resolved type for qualified annotations. Store java.lang.Deprecated in a class constant as requested in the ticket. Return the original annotation so its attributes remain available to shared-helper consumers.

Regression cases cover methods, enum methods, classes, fields, missing tags, unrelated qualified annotations, and annotation attributes. Existing tests exercise S1123 and S1133 with and without semantics. The shared helper also restores S1133 recognition of qualified annotations.

The direct Jira invocation and explicit operator handover authorize this scope. The existing regression and implementation commits were retained. Specification SHA-256: 4568a43f5f2aab7807a8a486da075b59e6886eb8c63f7d4e319f3d62f5c4a1a0. Decision record: none changed. No metadata or profile changes are needed for this existing-rule correction.

Validation and gates

The full test summaries report 5,082 tests with zero failures and errors, and four skipped. The original 31 focused regressions also passed. The full Maven install attempt failed during plugin packaging with heap exhaustion. Resuming packaging with a 2 GiB heap on both declared Java 26 and Java 21 also failed; no successful full install is claimed.

Independent review: clean, round 2, gpt-6.1-sol, zero blocking findings. The interrupted first attempt is retained and is not counted as a successful review.

Vortex supplied 10 project guidelines and 20 Java guidelines. These guided the small helper change and parameterized regression tests. Context and agentic analysis are enabled for the bound project. Final DEEP analysis found no issues across all four changed files. Changed-file secrets scanning and diff whitespace checks passed.

Local validation: unit tests passed; plugin packaging incomplete. Independent review: passed. Vortex: passed. CI, repository Sonar gate, automated reviewers, and review threads: pending live PR checks. Human approval: pending. Keep-draft: required by the requester in the operator handover; the requester will mark this PR ready.

Warnings and validation gaps

  • The independent reviewer could not execute Maven tests because its Develocity state was read-only. Host validation is reported above; independent test execution remains unverified.
  • Plugin packaging and the later verify/install stages remain incomplete because the local JVM exhausted its heap. The workspace has a 4 GiB memory limit. CI must verify these stages on this head.
  • Dependency-risk analysis could not discover manifests because the scanner raised a JGit reflection error. No dependency changes were made; this is an incomplete scan.
  • Ruling tests must run in CI under repository instructions. Plugin integration tests also remain for CI. Their results are required before the corresponding gates pass.
  • The requested .sonar-code-context/SONAR.md file is absent. Live project guidelines were retrieved. Reviewers can supply missing guidance if it affects this correction.
  • Repository ADR guidance is missing. Seeding it is outside this change.
  • Five historical attachment references remain unresolved. Historical impact counts conflict and were not verified. Acceptance uses the ticket's observable annotation defect and regression cases; reviewers can supply corrected impact evidence before any scope expansion.

Attachments used

  • 286374, history.json: reference for prior decisions.
  • 286376, proposed-approach-20260405-114737.md: requirement for the bounded correction.
  • 286377, simple-examples.json: reference for regression examples.
  • 286378, proposed-code.diff: reference for the proposed helper change.
  • 286423, actual-fix-coverage.json: reference; impact claims remain unverified.

Token usage: gpt-6.1-sol — 15,490,316 tokens, including 723,114 tokens attributed to the completed independent-review session. Accounting is measured, not a price estimate.

This PR was opened as a draft by the autonomous Fabrik workflow. It will remain in draft for the requester, including after its mechanical gates pass. Human approval and merge are required. No merge or deployment is authorized.


🤖 Co-authored by Fabrik

romainbrenguier and others added 2 commits November 10, 2026 08:42
Co-Authored-By: Fabrik <fabrik@sonar.ai>
Preserve short-name detection and resolve qualified annotation types against java.lang.Deprecated. Keep missing-tag reports for qualified annotations.

Co-Authored-By: Fabrik <fabrik@sonar.ai>
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

SONARJAVA-6048

@gitar-bot

gitar-bot Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · The shared helper now recognizes resolved java.lang.Deprecated annotations, changing S1123/S1133 findings and potentially suppressing or adding incorrect deprecation reports.

Recognizes qualified @java.lang.Deprecated annotations in S1123 when the declaration also carries an @deprecated Javadoc tag, removing incorrect missing-annotation reports including on protobuf-style enum methods. No issues found.

Verification Rules 2/2 met Repos 3 inspected · PRs 1 inspected

Functional validation No results

Rules 2 passed 1 not applicable

✅ Internal artifact registries
✅ Repository license compliance

Broader impact Repos 3 inspected PRs 1 inspected
Cross-repo 3 repositories inspected 0 open impacts

SonarSource/sonarqube Inspected
SonarSource/sonarlint-intellij Inspected
SonarSource/sonar-java-symbolic-execution Inspected

Cross-PR 1 PR inspected 0 open impacts

PR 6436: RC-352 Update ruling tests for the relocated sonar-server fixture Inspected

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@romainbrenguier

Copy link
Copy Markdown
Contributor Author

CI has resolved the plugin-packaging validation gap for head 080bb2ff36b1e806633790c0783dd066303dd2d3. The Build job created and installed the plugin artifact, passed its size check, and completed successfully.

The local heap-exhaustion result remains recorded. Windows unit tests, ruling QA, plugin QA, and analysis are still running. This PR will remain in draft for the requester.

Generated by Fabrik

@sonarqube-next

Copy link
Copy Markdown
Contributor

@romainbrenguier

Copy link
Copy Markdown
Contributor Author

The secret scanner flagged potential token data in two CI ruling logs. I excluded the flagged lines from review and did not read their values. These findings are in CI output, not in source lines changed by this PR.

REPORT-ONLY: Linux SonarQube ruling log, lines 2891 and 3000, secrets:S6702.
REPORT-ONLY: Windows SonarQube ruling log, lines 2760 and 2865, secrets:S6702.

The reviewed unflagged output shows successful ruling tests. No source change was made for these log findings.

Generated by Fabrik

@romainbrenguier

Copy link
Copy Markdown
Contributor Author

Gates passed, draft kept at requester request: #6499. Passed: validated head, required CI checks, Sonar quality gate, resolved review threads and required automated reviews. Mark it ready when your review is complete.

Generated by Fabrik

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant