Reflection.getCallerClass(n) does not skip reflection calls in constructors (original) (raw)
Weijun Wang weijun.wang at oracle.com
Sun Nov 25 21:46:24 PST 2012
- Previous message: Packed Objects
- Next message: Official reviewer needed: Review request for fix for 7200297: agent code does not handle multiple dll_dir paths correctly
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: Packed Objects
- Next message: Official reviewer needed: Review request for fix for 7200297: agent code does not handle multiple dll_dir paths correctly
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]