-
1. Re: Instrumenting JDK classes
kabirkhan May 22, 2005 5:16 AM (in response to oberon777)We do not allow for bytecode modification of java system classes. If you use execution/field/get/set they all modify the target class.
You can use caller pointcuts, which do not modify the target class only the caller class. So you would need to use something like the following for your pointcut expression:call(java.lang.Class java.lang.Class->forName(java.lang.String))
More info about this here:
http://docs.jboss.org/aop/1.1/aspect-framework/examples/caller/caller.html -
2. Re: Instrumenting JDK classes
oberon777 May 23, 2005 2:12 PM (in response to oberon777)Thank you very much for this link -- in fact it does almost everything I need!
The only thing missing is the ability to examine parameters and return values of calls at runtime. I.e. suppose I am interested in a call to Class.forName. I'd like to print the parameter string as well as the return value object. Calls to invocation.getArguments() only give me the argument *types*, it seems.
Thanks much,
-Ben -
3. Re: Instrumenting JDK classes
kabirkhan May 23, 2005 3:46 PM (in response to oberon777)Invocation.getArguments() should get you the actual parameters? Please check again and let me know if there is a problem.
The value of a return value can be done by examining the return of invocation.invokeNext() in you advice before returning it. -
4. Re: Instrumenting JDK classes
oberon777 May 24, 2005 2:35 AM (in response to oberon777)It's working now. Thanks a bunch.