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 <tutuf...@hotmail.com>: > > 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 > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users