Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] * in type patterns

Everybody,

I'm a little confused about the meaning of the * wildcard used in type
patterns. From what I've read, * stands for zero or more occurrences of any
character when used by itself. So,

pointcut p1() : call(public int *.*(..));

would match a call to any public method returning an in in any class in any
package (visible to the compiler).

When embedded within a sequence of characters, * stands for zero or more
occurrences of character except the package separator (.), so

pointcut p2() : call(public int somepackage.*.SomeClass.*(..));

would match any public method returning an int declared in the class
SomeClass in any direct subpackage of somepackage (right?)

However, when used like this:

Pointcut p3() : call(public int *SomeClass.*(..));

what is the meaning of * ? It is not embedded within a sequence of
characters, and neither is it used "by itself." The meaning also seems to be
neither of those mentioned above. It appears that it matches calls to
methods declared in any class whose name ends in "SomeClass", but only those
classes visible from within p3's source file (which is also strange since I
thought all types visible to the compiler were considered when using
wildcards?).

So to summarize my questions,

1. What exactly does the * stand for in p3?
2. Why aren't SomeClass in all packages matched by p3?

Thanks,
Jon

http://www.eecs.wsu.edu/~jbaekken/




Back to the top