SONARJAVA-6289 Fix QG / Fix issues with stream().foreach(...)#5585
SONARJAVA-6289 Fix QG / Fix issues with stream().foreach(...)#5585
Conversation
SummaryThis PR removes unnecessary
These are performance and clarity improvements—using the built-in What reviewers should knowWhat to look for:
Review strategy:
|
|
There was a problem hiding this comment.
LGTM! ✅
Clean, straightforward PR. All three changes are behaviorally equivalent and correct:
completedSecondariesis a freshArrayList(line 106), soaddAllis safe and idiomatic.undefinedTypesis aSet<JProblem>— iteration order was never guaranteed by either approach.- The
(VariableTree)cast in the test is safe: the fixture class contains only field declarations, somemberswill never contain a non-VariableTreeelement.
| // handle other main locations as secondaries with same message | ||
| mainLocations.subList(1, mainLocations.size()) | ||
| .stream() | ||
| .forEach(completedSecondaries::add); |
There was a problem hiding this comment.
@NoemieBenard Fyi, this use of forEach(collection::add) is another thing that may benefit from simplification.
No action needed.




No description provided.