SONARJAVA-6843: Implement S9365: Copy constructors should initialize all fields - #6024
SONARJAVA-6843: Implement S9365: Copy constructors should initialize all fields#6024nathsou wants to merge 5 commits into
Conversation
Code Review ✅ Approved 5 resolved / 5 findingsImplements rule S9365 to report copy constructors that leave eligible instance fields implicitly initialized, addressing issues with initialization blocks, symbol comparisons, and method receiver handling. No open findings remain. ✅ 5 resolved✅ Bug: Fields initialized in an instance initializer block are flagged
✅ Quality: Symbols compared by reference instead of equals()
✅ Edge Case: ++/-- on a field not counted while compound assignment is
✅ Quality: New isCurrentInstance rejection branches are untested
✅ Edge Case: Cast receiver on a self-call is neither followed nor treated as unknown
Implementation Status ✅ 1 of 1 objectives covered✅ SONARJAVA-6843 - 1 of 1 objectives coveredThis PR implements rule S9365 requiring copy constructors to initialize all eligible instance fields. ✅ 1 covered here
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|




Summary
Jira: https://sonarsource.atlassian.net/browse/SONARJAVA-6843
RSPEC: https://github.com/SonarSource/rspec/pull/7958
AI disclosure
LLM model used for implementation: gpt-5.6-sol (high reasoning)