Intellij watches and complex objects
Answered
Hi all,
I am having to debug a program with complex value objects where the only thing I'm interested in tracking in watches is a certain member of an item in a colllection of collections inside the object.
Let's say it's a car which has wheels, each of which has bolts and I'm interested in tracking just tightness on each wheel bolt throughout a lifetime of this car.
What would be the best way to set up a watch like this? It's extremely time consuming to use expand and collapse each branch in watches view (as great as it is that you can do that).
Any ideas welcome!
Please sign in to leave a comment.
You can add a new watch and type the condition using code completion.
https://www.jetbrains.com/help/idea/adding-editing-and-removing-watches.html
Hi! Thanks for your response.
There are 2 reasons while just watches don't work for me:
- putting the watch on the complex object means I have to expand down to a member or an entry in a collection of collections in it (this is something like 20 screens long if I were to do it for every one I want to watch)
- exposing the very values I'm interested in would mean I would have to write nested foreach loops in a watch (the count of the collection I mentioned may vary) - I've tried nested loops and had some problems with this - I assume this isn't possible (?)
Non-simple watches:
- when writing a java class renderer it also didn't parse for me - possible problems are the foreach loops again and/or using custom classes in the renderer (imports) - any hint on this, please let me know
Thanks.
Also have a look at: https://stackoverflow.com/questions/46158501/intellij-is-it-possible-to-use-loops-in-watches-or-in-custom-class-renderers