Reputation: 145
I am trying to view the instance variables values of the Arraylist in eclipse in debug mode but apart from the values in the list am unable to view variables like elementData or modCount that are part of the arraylist. I have tried using Watch, Display option as well but to no avail. Below is my screenshot after setting the breakpoint and triggering the program run:
Below is the screenshot that I found in one of the websites where the instance variables like elementData,modCount and size are visible:
Upvotes: 2
Views: 4136
Reputation: 116
Go to Window->show view->expressions then in Expressions window go to variables tab there you will see your variables right click on any one of them you will see Show logical structure. Untick the Array option from there and debug again you will see elementData,modCount and size varibles.click here for image
Upvotes: 1
Reputation: 4956
In oxygen, "Show Logical Structure" is enabled by default. All you have to do is click on it to disable it.
[Image taken from eclipse.org]
Upvotes: 3
Reputation: 86774
In the current version (Oxygen.3) the default formatter for Collection
shows only the members of the collection as an array. I'm not sure when the more detailed formatter was removed, but you can easily create a logical structure formatter.
Right click on the variable in the Variables tab and select Show Logical Structure/Edit Logical Structure
Your view will have the Collection
entry hilighted, and won't contain the ArrayList
entry I just created.
Add a new entry:
Provide the class name you want to format, and a description. Select List of Variables
and then add the variables you want to display, providing a code snippet for each one. The code snippet executes as a method of the class.
End result:
Upvotes: 5
Reputation: 431
In some instances that I cannot view variables, like in your case, I would suggest using Expression tab and add new expression. To load expression tab on Eclipse IDE, click on Window > Show View > Expression. Set breakpoint, hit debug, then expression tab should load arrNames
and you can expand to view properties and data.
Upvotes: 1