Repository navigation
Conversation
329ad95 to
e344aee
Compare
|
Code Review ✅ Approved 3 closed / 3 findings🟡 Medium risk · Adding S9437 changes analyzer findings for no-argument static getInstance methods; imperfect matching could flag intentional fresh-instance factories. Implements rule S9437 to flag static no-argument ✅ 3 closed✅ Quality: 'WithoutBody' sample has a body, so the null-block branch is untested
✅ Edge Case: Own-class check misses generic and raw instantiations
✅ Quality: Rule description says issues need no static field read
Verification Repos 5 inspectedFunctional validation No results Rules No rules evaluated Cross-repo 5 repositories inspected 0 open impacts
Auto-approval Not enabledFor more verification details, comment 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 |
|
/pvf |
|
📊 Performance Validation complete |




Implements S9437, specified in https://github.com/SonarSource/rspec/pull/8339.
The rule raises when a static no-argument
getInstancemethod has a body consisting only ofreturn new <OwnType>(...);, so nothing is cached and every caller gets a separate object.Scope decisions, matching the RSPEC:
getInstance(...)is a factory keyed on its arguments, following the JDK convention.create,newInstance,oforvalueOfare not reported.Primary location is the instance creation, with a secondary location on the method name.