Priority
Normal
Type
Bug 
State
Fixed 
Assignee
Bas Leijdekkers 
Subsystem
Code Analysis. Inspection 
Affected versions
Fixed in
Fixed in build
Next build 
Visible to
All Users 
  • Submitted by   Sascha Weinreuter
    4 years ago (23 Aug 2005 16:23)
  • Updated by   root
    7 weeks ago (17 Jan 2010 19:22)
  • Jira: IDEA-29870
    (history, comments)

IDEA-29870

"Contents of Collection are queried, but never updated" is wrong for java.util.Properties

0
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 (1)
 
Linked Issues (0)
 
Sascha Weinreuter
  Sascha Weinreuter
23 Aug 2005 16:31
(4 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 16:53
(4 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 16:58
(4 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 17:08
(4 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 17:21
(4 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 19:04
(4 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 19:32
(4 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 01:24
(4 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 03:07
(4 years ago)
#
And now you go and focus attention on it. I never noticed it before. This won't do.