[java-inspections] Refactor and improve MismatchedCollectionQueryUpdate

1. Track separately updates that have no effect on empty collection
2. Extract MismatchedQueryUpdateRunner to avoid lots of arguments
3. Make QueryUpdateInfo immutable record
4. Track variables containing derived collections
5. Track iterators as derived collections

Fixes IDEA-356315 Incorrect suggestion of Stream.toList() when followed by Iterator.remove()

GitOrigin-RevId: 3b7fd99b2310f123e924034f7c623bd01e4e4c40
This commit is contained in:
Tagir Valeev
2024-10-21 17:40:32 +00:00
committed by intellij-monorepo-bot
parent 4c5baed284
commit dd15592444
5 changed files with 244 additions and 137 deletions
@@ -123,7 +123,9 @@ mismatched.read.write.array.display.name=Mismatched read and write of array
mismatched.read.write.array.problem.descriptor.write.not.read=Contents of array <code>#ref</code> are written to, but never read #loc
mismatched.read.write.array.problem.descriptor.read.not.write=Contents of array <code>#ref</code> are read, but never written to #loc
mismatched.update.collection.display.name=Mismatched query and update of collection
mismatched.update.collection.problem.descriptor.updated.not.queried=Contents of collection <code>#ref</code> are updated, but never queried #loc
mismatched.update.collection.problem.description.no.effect.updates=Update operations on empty collection <code>#ref</code> have no effect #loc
mismatched.update.collection.problem.description.updated.not.queried=Contents of collection <code>#ref</code> are updated, but never queried #loc
mismatched.update.collection.problem.description.queried.empty=Contents of empty collection <code>#ref</code> are queried, but it's never populated #loc
mismatched.update.collection.problem.description.queried.not.updated=Contents of collection <code>#ref</code> are queried, but never updated #loc
rename.quickfix=Rename
renameto.quickfix=Rename to ''{0}''