2

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:

enter image description here

Below is the screenshot that I found in one of the websites where the instance variables like elementData,modCount and size are visible:

enter image description here

1
  • Which Eclipse version are u using and what's the version in the mentioned site? May be they are not shown anymore. Commented Jun 15, 2018 at 18:55

4 Answers 4

5

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

enter image description here

Your view will have the Collection entry hilighted, and won't contain the ArrayList entry I just created.

Add a new entry:

enter image description here

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.

enter image description here

End result:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

3

In oxygen, "Show Logical Structure" is enabled by default. All you have to do is click on it to disable it.

enter image description here

[Image taken from eclipse.org]

Comments

1

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.

Expression Tab

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.