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!

0
3 comments
Avatar
Permanently deleted user

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.

0

Please sign in to leave a comment.