This discussion is archived
0 Replies Latest reply: Apr 15, 2010 7:28 AM by 843810 RSS

JPDA/JDI retrieve the content of an ArrayList

843810 Newbie
Currently Being Moderated
A few months ago I started using the JDI for developing a kind of "debugger".

What I want to do is retrieve the content of ArrayList(s) as the content of this ArrayList is changed (add, remove)?

I wrote a script that retrieves the content of an ArrayList:
public void fieldWatchEvent(ModificationWatchpointEvent event)  {
        Field field = event.field();
        Value value = event.valueToBe();
              ObjectReference t = (ObjectReference) value;
              Value value2 = t.getValue(t.referenceType().fieldByName("elementData"));
              ArrayReference r = (ArrayReference) value2;
             System.out.println("This array contains this values :" + r.getValues());
Is there an easier way for retrieving the content of an Array and is it possible to do this when the content of the ArrayList changes?

Thanks in advance,