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.

Regards,
Jeroen


_______________________________________________
Classpath mailing list
Classpath@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to