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:
More info about this here:
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.
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.
It's working now. Thanks a bunch.