AspectJ - Why Don't @Around JoinPoint Breakpoints Get Hit?
I took this example here to test out some AspectJ features.
http://denis-zhdanov.blogspot.ca/2009/08/weaving-with-aspectj.html
If I put a breakpoint on the System out here I can hit it just fine.
@Aspect
public class TestAspect {
@Before("execution (* com.aspectj.TestTarget.test*(..))")
public void advice(JoinPoint joinPoint) {
System.out.println("TestAspect.advice() called on '%s'%n", joinPoint);
}
}
However, if I change it to an @Around joinpoint the breakpoint is not hit but the console shows that the code in the joinpoint was run.
@Around("execution (* com.aspectj.TestTarget.test*(..))")
public Object advice(ProceedingJoinPoint invocation) throws Throwable {
System.out.println("Around TestAspect.advice() called on '%s'%n", invocation);
return null;
}
Is there a reason why the @Around is not hit? It doesnt get hit in eclipse either.
Please sign in to leave a comment.
Decompiling bytecode shows that in the latter case the advice is inlined as a synthetic method in the TestTarget class, so that actuallTestAspect.advice() method is never executed.