How do I suppress "Contents of collection are queried but never updated"
Is there a way to suppress this warning?
I have collections that I query multiple times in a method but never actually update, so while this warning is technically correct, it feels annoying to see yellow in my code for something I am doing intentionally.
thx
andy
Please sign in to leave a comment.
Andy Kriger wrote:
That sounds like the inspection is incorrectly triggering. It should
detect that you are initializing the collections in some way but never
updating them. Unless you are intentionally querying empty uninitialized
collections, in which case, just disable the inspection or live with the
yellow ;)
Ciao,
Gordon
--
Gordon Tyler (Software Developer)
Quest Software <http://www.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001
Is it actually that your queries are pointless, or is there an update of the collection that is being missed? If the inspection is actually correct, you can suppress it just like any other inspection, with a @SupressWarnings annotation or a //noinspection comment. The quickfix should supply either one, if you want.
--Dave Griffith
I have class A that extends HashMap. In a method in class B, I create an instance of A (which initialized A with info in A.init) and get values from A. So I'm not updating A in B, but I don't need to so I don't want to see the inspector warning.
@SuppressWarnings("all") doesn't seem to have any affect on the code.
Hello,
do you use @SuppressWarnings("ALL") or as you mentioned @SuppressWarnings("all")? In first case, could you please give me a code fragment where it is not work.
Thank you.