Thursday, June 14, 2001 09:25 AM
No it cannot be done easily.
The references returned by the debugger are proxies and not the original object references. i.e. There Types are completely different e.g. JPDA returns
com.sun.jdi.ObjectReference (implementation) for every object reference in the debugee.
Unless you intercept the creation of every object in the VM, store the reference to it in a WeakHashMap (otherwise the garbage
collection will never work) using some kind of name(?) as a key. You could use
a the name to look it up in the
WeakHashMap later. You will have to basically maintain a Symbol Table. You may want to implement Symbol Scopes and soon you software starts approaching what are called Java Shells. That wheel has already been invented several times.
Please look into -
But the fact that it is possible to write such a tool (using Reflection) in Java is fantastic.