Project
IntelliJ IDEA
Priority
Normal
Type
Bug
Fix versions
No Fix versions
State
Fixed
Assignee
Bas Leijdekkers
Subsystem
Code Analysis. Inspection
Affected versions
No Affected versions
Fixed in build
108.65  
  • Created by   Sascha Weinreuter
    6 years ago (23 Aug 2005 17:23)
  • Updated by   root
    2 years ago (17 Jan 2010 20:22)
  • Jira: IDEADEV-2304
    (history, comments)
 
IDEA-29870 "Contents of Collection are queried, but never updated" is wrong for java.util.Properties
0
Issue is visible to: All Users
  The issue is visible to the selected user group only
It doesn't recognize Properties.setProperty() as an update method (it recognizes load() though).

What about recognizing the patterns add*, set*, put*, insert* and remove* as update methods?

Issue was resolved
Comments (9)
 
History
 
Linked Issues (?)
 
Sascha Weinreuter
  Sascha Weinreuter
23 Aug 2005 17:31
6 years ago
Why is "trimToSize" considered an update method? It doesn't actually update the contents of a collection (ArrayList/Vector), but only optimizes the storage space that is used for the collection.
Bas Leijdekkers
  Bas Leijdekkers
23 Aug 2005 17:53
6 years ago
It currently uses a lookup in a HashMap which is faster than pattern matching. Also add*, set*, insert* and remove* don't cover all cases, it also needs to match clear*, retain*, offer and load. Do you think it would work significantly better if the inspection would recognize patterns?
I'll add setProperty to the list. I have no idea why trimToSize is considered an update method and I'll remove that.
Bas Leijdekkers
  Bas Leijdekkers
23 Aug 2005 17:58
6 years ago
I will also add getProperty(), propertyNames(), save(), store(), storeToXml() and enumeration() as query methods and loadFromXml() as update method.
Sascha Weinreuter
  Sascha Weinreuter
23 Aug 2005 18:08
6 years ago
Well, I didn't mean to replace the current list with only those patterns, but considering that other Collection spin-offs might stick to such a naming scheme it would reduce the chance for false positives - as in the setProperty() case I stumbled across. Maybe it's not worth the effort though.
Bas Leijdekkers
  Bas Leijdekkers
23 Aug 2005 18:21
6 years ago
At this moment I would consider it too much effort. If you were willing and had time to implement it I would definately add it however. If not I will close this request, now that I expanded the update and query lists.
Sascha Weinreuter
  Sascha Weinreuter
23 Aug 2005 20:04
6 years ago
You can close it. if I come across another case where a pattern might help I'll give it a go.
Bas Leijdekkers
  Bas Leijdekkers
23 Aug 2005 20:32
6 years ago
Thanks Sascha. If you ever want to give it a go, start in the CollectionQueryCalledVisitor and CollectionUpdateCalledVisitor classes.
Sascha Weinreuter
  Sascha Weinreuter
24 Aug 2005 02:24
6 years ago
I just realized that the title of this issue is wrong (I can't edit it though): it should of course be "Contents of Collection are queried, but never updated ...".
Darn browser-history :(
Bas Leijdekkers
  Bas Leijdekkers
24 Aug 2005 04:07
6 years ago
And now you go and focus attention on it. I never noticed it before. This won't do.