2 Replies Latest reply: Aug 28, 2008 5:04 PM by 843810 RSS

    JDI events for array types (ArrayReference)

      What is the best way to get information on the creation of arrays (ArrayReference types). I have an application that needs to detect the creation of objects, set watchpoints on the variables of these objects and create an object based on this targetVM-object. I do this now through the MethodEntryEvent and check wether the method is a constructor. If so, I check the declaringType of the object AND set watchpoints on it's fields. This does not seem to work with array type objects however...

      I use a not-so-pretty workaround now where I check watchPointEvent for the type of the field that is altered. If it's of type ArrayReference, I create an array based on this ArrayReference, I have to do the same for locals at each stepEvent. Isn't there a better way. Do array types not use constructors so I could use the same way as for other objects (see first paragraph)?