> but it seems a little bit confused to me for the aspectj schema. > Isn't it a little redundant to duplicate the HelloAspect in both the aspect and weaver section.
If you had compiled the aspect with ajc you wouldn't need to do this, but it is because you used something else. Recognizing unfinished aspects could be done, but it isn't at the mo. cheers, Andy On 5 June 2014 08:19, 马leon <[email protected]> wrote: > Hi, Alexander > > It works now! > > FYI: > > > > Ah, it works! > > but it seems a little bit confused to me for the aspectj schema. > Isn't it a little redundant to duplicate the HelloAspect in both the > aspect and weaver section. > > At first sight, I just guess that classes in <aspects> section will > participate in weaving for sure. > > Anyway, Thanks a lot!! > > Leon > > > ------------------------------ > Date: Thu, 5 Jun 2014 07:25:27 -0700 > From: [email protected] > To: [email protected] > Subject: Re: [aspectj-users] NoSuchMethodError for a simple hello world > aspect in scala > > Your aop.xml file doesn't include your aspect for weaving, I think if you > add it, that will do it. Try this aop.xml: > > <aspectj> > <aspects> > <aspect name="com.leon.aop.HelloAspect"/> > </aspects> > > <weaver options="-XnoInline"> > <include within="com.leon.aop.HelloWorld"/> > <include within="com.leon.aop.HelloAspect"/> > </weaver> > > </aspectj> > > Certainly the error indicates the weaver didn't 'finish off' the aspect by > adding the aspectOf() method. > > Andy > > > ------------------------------ > From: [email protected] > Date: Thu, 5 Jun 2014 16:34:32 +0200 > > To: [email protected] > Subject: Re: [aspectj-users] NoSuchMethodError for a simple hello world > aspect in scala > > I do not speak Scala, but I guess the methkd's return value will be its > last statement's value. For void methods this might not make much > difference (no idea), but generally I suggest you explicitly return the > result of 'proceed()' (or whatever you want to return instead) if > 'proceed()' is not the method's last statement. > -- > Alexander Kriegisch > http://scrum-master.de > > > Am 05.06.2014 um 16:01 schrieb 马leon <[email protected]>: > > Hi, > > I'm trying to do some hello world test in scala, here're code: > > > class HelloWorld { > def sayHello() : Unit = println("Hello word") > } > > > @Aspect > class HelloAspect { > > @Around(value = "execution (* com.leon.aop.HelloWorld.sayHello())") > def testCP(jp: ProceedingJoinPoint) { > > println("Start...") > jp.proceed() > println("End...") > > } > > } > > > myaop.xml: > > > <aspectj> > <aspects> > <aspect name="com.leon.aop.HelloAspect"/> > </aspects> > > <weaver options="-XnoInline"> > <include within="com.leon.aop.HelloWorld"/> > </weaver> > > </aspectj> > > > launcher VM settings: > > -javaagent:C:\Users\lma\.ivy2\cache\org.aspectj\aspectjweaver\jars\aspectjweaver-1.7.4.jar > -Dorg.aspectj.weaver.loadtime.configuration=META-INF/myaop.xml > > > > Testing class: > > class HelloAspectTest extends FlatSpecLike with Matchers { > > "HelloAspect" should "work" in { > val t = new HelloWorld > t.sayHello() > } > } > > > > Yet I got below exception: > > An exception or error caused a run to abort: > com.leon.aop.HelloAspect.aspectOf()Lcom/leon/aop/HelloAspect; > java.lang.NoSuchMethodError: > com.leon.aop.HelloAspect.aspectOf()Lcom/leon/aop/HelloAspect; > at com.leon.aop.HelloWorld.sayHello(HelloWorld.scala:7) > at > com.leon.aop.HelloAspectTest$$anonfun$1.apply$mcV$sp(HelloAspectTest.scala:15) > at com.leon.aop.HelloAspectTest$$anonfun$1.apply(HelloAspectTest.scala:13) > at com.leon.aop.HelloAspectTest$$anonfun$1.apply(HelloAspectTest.scala:13) > > > Anyone could help me on this? > > > Thank > > Leon > > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > > _______________________________________________ aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > >
_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
