I'm total newbie to AspectJ - so I might be missing something very obvious.
I went through few articles online and found a typical practice:
There is an empty pointcut 'p' (i.e. an empty method with @Pointcut annotation) - having an expression 'e' (which matches a set of methods). Further, there is an advice 'a' - which is written for pointcut 'p'.
My question is - what is purpose of empty pointcut? I tried and found that I do not need empty pointcut. I can directly write an advice 'a' for an expression 'e'.
When you do not define that empty @Pointcut method (which does not necessarily have to be empty), but instead define it on the advice it is referred to as an anonymous or un-named pointcut. You can draw a parallel to an anonymous class in Java. This is fine for simple point cuts but it suffers the same downsides of an anonymous class specifically it cannot be reused and is not as readable or maintainable. When you use the empty method it can be referenced from many advices and the name of the method can clearly specify the purpose of the pointcut expression.