Tuesday, August 29, 2006

A Whole Lotta' Instances

A first draft of another one of the new Java SE 1.6 features is out and ready to be played with. Much like the other feature (All References), All Instances works in pretty much the same way. You can right-click on a variable and select the All Instances... menu item, and before you know it WHAM, you see a popup showing you all of the instances of the selected object in the current VM. Isn't that dandy.

Much like it's companion All References, you of course need a Java SE 1.6 VM to use this feature, and you must be debugging at the time (i.e. have variables in the variables view). There are plans in the mix to expand its availabilty to the Outline View and to a context menu in the java editor....we shall see.

The first image below shows the location of the new action, and in this case we have selected a string, which will result in a popup showing all of the instances of type String in the current VM.

This next image shows the resulting popup (yes it is the inspect popup) telling us that there are 769 instances of String in the current VM. Allow me to say again, dandy.

To try out this...dare I say again...dandy new feature, you will have to wait until the next build or grab the source from HEAD.


  1. What trouble me about "All References" and "All Instances" is that they don't really allow to analyse the results. It would make sense to allow to copy content of those trees to the clipboard, or bring them into the memory view and allow to search trough them.

    On the other hand, I wonder what are the use cases for those features? They are cool, but I can't hardly think of real use. To me it seem like new Netbeans heap walker looks more practical.

  2. There is a new feature for "All References". I will be posting about it in the near future.

    The new feature allows you to view references as part of the variables view. You can copy the list to the clipboard, see how references change when stepping and navigate through them easier.