Your advice works for me - are you sure you have a method that matches it? Here is a complete program that works:
====8<==== B.java package com.mycom.mypack; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; public class B { public static void main(String[] argv) { System.out.println(myclass.myMethod()); } } @Aspect class Azpect { @Pointcut("within(com.mycom.mypack.myclass)") public void withinMyPackage() { } @AfterReturning(pointcut = "execution(public static * myMethod ( .. )) " + " && withinMyPackage() ", returning = "myResult") public void provideAdviseAfterReturning(MyType myResult, JoinPoint jp) { // do something with returned results System.out.println("advice handling "+myResult); } } class myclass { public static MyType myMethod() { return new MyType(); } } class MyType { } ====8<===== when I run it: advice handling com.mycom.mypack.MyType@24a37368 com.mycom.mypack.MyType@24a37368 Andy On 25 May 2012 08:33, Srinivas S Tamvada <tssrini...@yahoo.com> wrote: > Hi > I have a very simple point cut, but the method return does not seem to be > intercepted. > Is the syntax wrong ? > > Thanks ! > > @Pointcut("within(com.mycom.mypack.myclass)") > public void withinMyPackage() {} > > @AfterReturning(pointcut = "execution(public static * myMethod ( .. )) " > + " && withinMyPackage() " , returning = "myResult" > ) > public void provideAdviseAfterReturning( MyType myResult , JoinPoint jp > ) { > > // do something with returned results > > } > > > > _______________________________________________ > 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