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)?
Pretty creative efforts! Unfortunately, array creation isn't done by constructors, it is done by bytecode instructions.
Search for 'array' here: [http://www.javaworld.com/jw-12-1996/jw-12-hood.html] .
I can't think of an easy way to do what you want. Can anyone else?