SonarCloud remove candidate rule: java:S1168 Empty arrays and collections should be returned instead of null #9925
CDellaGiusta
started this conversation in
Polls
Replies: 1 comment
-
As you say, this can have a high risk in a code base as old as this one. If somewhere it's checking for null and we change the logic to always return an object we are change the method behaviour, and this kind of issues are normally hard to debug and find. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This poll closes Friday, April 18th 2025.
Candidate rule for removal: java:S1168
Number of issues with this rule in Uyuni: 49
Rule: Empty arrays and collections should be returned instead of null
Software qualities impacted: MAINTAINABILITY
Why is this an issue:
Should it be removed?:
Legacy code could checking for null with a certain meaning in the caller (where an empty list could mean something else).
All rule issues in Uyuni: https://sonarcloud.io/project/issues?languages=java&issueStatuses=OPEN%2CCONFIRMED&id=uyuni-project_uyuni&rules=java%3AS1168
Examples in our code:
8 votes ·
Beta Was this translation helpful? Give feedback.
All reactions