Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Eclipse debugger getting results of method calls

I have a relatively complex object which among other things has a ConcurrentHashMap inside it. Within the debugger i'd like to see the results of calling the .size() method but I dont actually want this in my code nor do I want to put it in.

Debugger image http://img153.imageshack.us/img153/1695/will.png.

Above you can see what I have avail but id love to be able to somehow call/see the results of the .size() method

I can however see lots of references to Maps and segments etc but they are just values.

Just wondering if its possible ?

like image 458
wmitchell Avatar asked Dec 10 '22 17:12

wmitchell


2 Answers

In the debugger, open the Display view. This will allow you to evaluate an expression that you enter.

See http://www.ibm.com/developerworks/library/os-ecbug/ under "Scrapbooking your live code".

Here is a more detailed article: http://larsho.blogspot.com/2008/07/my-favorite-eclipse-view.html

like image 98
danben Avatar answered Dec 18 '22 22:12

danben


As an alternative to running the size() method in the Display view, you can simply press the "Show Logical Structure" button on your Variables window and the display of your Map will change to view like an array of entries. The size of the array is the size of your Map.

like image 29
Robin Avatar answered Dec 18 '22 22:12

Robin