classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Implementation details of VMStackWalker


From: Andrew Haley
Subject: RE: Implementation details of VMStackWalker
Date: Mon, 25 Jul 2005 10:02:03 +0100

Jeroen Frijters writes:
 > Andrew Haley wrote:
 > > In gcj, we have a method called GetCallingClass(Class c).  It searches
 > > firstly for a method declared in class c, then for a method not
 > > declared in c.  We have found, after a certain amount of trouble, that
 > > this is the right way to do things; it means that an arbitrary number
 > > of stack frames can be between the direct caller of GetCallingClass
 > > and the user code, and it also means that you don't have to check for
 > > assignability, but for an exact match.
 > 
 > This is a dumb idea...
 > 
 > > For example, you may have
 > > 
 > > class Foo
 > > {
 > > bar (Object O)
 > > {
 > >    return baz(O);
 > > }
 > > 
 > > baz (Object O)
 > > {
 > >   ... GetCallingClass (Foo) ...
 > > }
 > > }
 > 
 > class Frob extends Foo
 > {
 >   baz (Object o)
 >   {
 >     super.baz(o);
 >   }
 > }
 > 
 > > ... and you will get class of the caller of bar, not Foo.class.
 > 
 > No, you'll get Frob.

Which is the Right Answer: the caller of baz *is* Frob.

Andrew.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]