Hi

I'm trying to use Reflection.getCallerClass(n) to find out who is calling a method. The method's spec says:

                                     .... Frames associated with
    java.lang.reflect.Method.invoke() and its implementation are
    completely ignored and do not count toward the number of "real"
    frames skipped.

This is very nice but it does not mention Constructor.newInstance(). In fact, I do see the following entries if I'm creating an object thru reflection:

   Callee
   class sun.reflect.NativeConstructorAccessorImpl
   class sun.reflect.NativeConstructorAccessorImpl
   class sun.reflect.DelegatingConstructorAccessorImpl
   class java.lang.reflect.Constructor
   Caller

Is there any reason why we cannot do the same for constructor instantiation?

Thanks
Max

Reply via email to