-
1. 3855289
huqiao Nov 10, 2004 8:17 PM (in response to huqiao)Specify the jboss.aop.optimized system property and set it to false, i.e:
<aopc compilerclasspathref="classpath" classpathref="classpath" verbose="true"> <sysproperty key="jboss.aop.optimized" value="true"/> <classpath path="./bin"/> <src path="./bin"/> <aoppath path="jboss-aop.xml"/> </aopc>
-
2. Re: how to change the arguments of a method by AOP?
huqiao Nov 10, 2004 9:24 PM (in response to huqiao)hi,
there was a mistake in my first post.
the xml file i have tried is as follows.<?xml version="1.0" encoding="UTF-8"?> <aop> <bind pointcut="call(void $instanceof{SomeInterface}->someMethod())"> <interceptor class="SimpleInterceptor"/> </bind> </aop>
-
3. Re: how to change the arguments of a method by AOP?
nthx Nov 11, 2004 4:57 AM (in response to huqiao)Hi
It works.
You must use "execution" joinpoint instead. It won't work with "call" joinpoint as it doesn't make sense. Even if it works with AspectJ, when I think about "call" type it looks strange to change called method's arguments from caller context.
Is there some special reason you can't use "execution" joinpoint?
So your code should use MethodInvocation class instead, and binding should be<bind poincut="execution(void i$instanceof{SomeInterface}->someMethod())">....
:)
Tomasz Nazar -
4. Re: how to change the arguments of a method by AOP?
huqiao Nov 11, 2004 9:30 AM (in response to huqiao)hi,
what i really want to do is try to change the arguments of method for a system class by interceptor. so i can only use the "call" joinpoint. it is possible to get the argument of the caller, but i do not know how to set (change) the argument of the callee.
Qiao@Osaka -
5. Re: how to change the arguments of a method by AOP?
reverbel Nov 12, 2004 9:28 AM (in response to huqiao)It should be possible to change method arguments at call joinpoints.
Your example works with the call joinpoint if you turn optimization off (-Djboss.aop.optimized=false).
Cheers,
Francisco -
6. Re: how to change the arguments of a method by AOP?
bill.burke Nov 12, 2004 9:33 AM (in response to huqiao)Looks like there's a bug in optimized CallBy invocations?
-
7. Re: how to change the arguments of a method by AOP?
reverbel Nov 12, 2004 9:43 AM (in response to huqiao)Yes.
Francisco -
8. Re: how to change the arguments of a method by AOP?
huqiao Nov 14, 2004 8:58 PM (in response to huqiao)hi,
could you tell me how to turn JBOSS AOP optimization off in the build.xml of ant?<target name="compile" depends="prepare"> <javac srcdir="." destdir="./bin" debug="on" deprecation="off" optimize="off" includes="**"> <classpath refid="classpath"/> </javac> <aopc compilerclasspathref="classpath" classpathref="classpath" verbose="true"> <classpath path="./bin"/> <src path="./bin"/> <aoppath path="jboss-aop.xml"/> </aopc> </target>
Qiao@Osaka -
9. Re: how to change the arguments of a method by AOP?
kabirkhan Nov 15, 2004 4:37 AM (in response to huqiao)Specify the jboss.aop.optimized system property and set it to false, i.e:
<aopc compilerclasspathref="classpath" classpathref="classpath" verbose="true"> <sysproperty key="jboss.aop.optimized" value="true"/> <classpath path="./bin"/> <src path="./bin"/> <aoppath path="jboss-aop.xml"/> </aopc>
-
10. Re: how to change the arguments of a method by AOP?
kabirkhan Nov 16, 2004 5:18 AM (in response to huqiao)Strange, I am pretty sure there was a way to turn this off last time I checked (months ago), but it does not appear to be there now unless I am missing something very obvious.
In any case, I have added a fix to cvs, to allow you to specify an optimize property on the aopc task. Set it to false to turn off optimizations, i.e.:<aopc compilerclasspathref="classpath" classpathref="classpath" verbose="true" optimize="false"> <classpath path="."/> <src path="."/> <aoppath path="jboss-aop.xml"/> </aopc>
The optimize attribute defaults to true if not specified.
If you are not familiar with building from cvs, the following thread contains details (it spans over a few pages):
http://www.jboss.org/index.html?module=bb&op=viewtopic&t=52857
HTH -
11. Re: Mixin class at the class level
huqiao Nov 18, 2004 12:00 AM (in response to huqiao)Not anytime soon, but come to think of it you could probably implement it with the current mechanisms, but you'd have to do it yourself...
<construction>SomeIntroductionFactory.yourPerClassAspect(this.getClass())</construction> Get me? Bill