finding out when objects go out of scope?

Derek Wyatt <[email protected]> Fri, 24 Oct 2003 17:04:13 -0400
Newsgroups gmane.comp.java.jswat.user
Message-ID <[email protected]>
Hi,

I was wondering if it's possible to use jswat (or any implementation of the
JDI) to find out when an object goes out of scope.  I poked around, and read
some stuff, and experimented a little, but i didn't really get any hints.  

The problem is that we've got a lot of developers that are _supposed_ to never
let an exception go out of scope (i.e. keep passing the reference along).
However, they don't always do this.  When they don't it's a real bear to find
out when it happened and who did it the information got lost.  The simplest way
for me to tell is to find out that they caught the exception and then
constructed a new one, while letting the one they caught get thrown out of
scope, whereas they _should_ have stored it inside the new exception.

It would be great if i can have something watch all constructors of Throwable,
store the reference of each one as they are constructed, and get notified when
they go out of scope.  Then i can track down the function that let them
disappear so i can point the finger to the right place.

Thanks,
Derek

-- 
-----------------------------------------------------------
Derek Quinn Wyatt      |  Phone: (905) 886-7818 ext. 2313
Syndesis Engineering   |  Fax:   (905) 886-9076
Toronto, Ontario, CAN  |  Email: [email protected]
-----------------------------------------------------------
"Go away or I will replace you with a small, more cost-effective
 shell script."