On 11/26/2010 3:38 PM, puchacz wrote:
> Hi,
>
> Is it possible to get a reference to caller object (and recursively
> all the way up the call stack)? [...]
Maybe. What do you mean by "caller object?" For example, in
public class Piotr {
public static void main(String[] unused) {
System.out.println(hello());
}
private static String hello() {
// What is the "caller object" here?
return "Bonjour";
}
}
> [...] I know in general
> it is probably possible, because this is what debuggers do when
> showing stack frame.
The debuggers I have used will show the method associated with
each stack frame, and the class the method belongs to, and the source
code's line number (if it's available). I have not seen a debugger
that shows anything I would term a "caller object," so again: What
do you mean? More to the point, what problem are you trying to solve?
--
Eric Sosman
lid