1

I have seen two variations of pointcut patterns:

This

execution(* some.package.*.*(..))

and this

execution(* some.package.* *(..))

What is the meaning of the dot (or of it absence) between the last two *'s?

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348

1 Answers1

2

This appendix defines grammar of the pointcut expression langauge. For the execution expression the rule is the following:

execution(MethodPattern)

where

MethodPattern = 
  [ModifiersPattern] TypePattern 
        [TypePattern . ] IdPattern (TypePattern | ".." , ... ) 
        [ throws ThrowsPattern ]

That means that if you have 3 expressions (separated by space) before "(", then the first is modifier, second is class and third is method name. But if you have 2 expressions before "(", then first will be class and second will be method name.

Andrey Adamovich
  • 20,285
  • 14
  • 94
  • 132
  • Ok, it's getting a little clearer now. But in the production rule I have two places to put a TypePattern, what is the difference between using one or the other? Does it make sense to use both? – Jens Schauder Mar 02 '11 at 13:28
  • I think there is no difference, but it is a bit confusing to use both type patterns at once. But probably in some situations it may be useful to refer to inner types. – Andrey Adamovich Mar 02 '11 at 13:51
  • I actually do think there is a difference, it behaved very differently in a use case I had, but I don't understand the principle behind the difference – Jens Schauder Mar 03 '11 at 07:04
  • 1
    Now I'm starting to understand it myself :). First TypePattern is actually a return type of the method, second TypePattern is location class of the method. – Andrey Adamovich Mar 03 '11 at 07:33