Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] what is the semantics of ".." in methodnames?

The pointcut expression:

>    pointcut pc(): call(* *.my..Method());

is interpreted as

"a call to a method returning any type, in a type in a package with
one leading identifier, followed by "my", followed by zero or more
additional package qualifiers and zero or more types, where the method
is named "Method" and takes no parameters"

for example:

com.my.app.SomeClass.Method()

we realise by convention that "my..Method" was probably intended to be
a method name pattern since methods don't usually start with capital
letters, but from the compilers perspective you have created a pattern
that is perfectly valid but seldom used and so it matches as described
rather than giving an error.

On 08/09/05, Stefan Hanenberg <shanenbe@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hi all,
> 
> it is syntactically possible to specify a ".." within a methodname. Does
> it have any semantics or is it ignored?
> 
> (BTW: I know the semantics of ".." for type patterns or typeslists)
> 
> Example:
> 
> public class Main {
>    public static void main(String[] args) {
>      new main().myXYZMethod();
>    }
>    public void myXYZMethod() {
>      System.out.println("method");
>    }
> }
> 
> public aspect MyAspect {
>    pointcut pc(): call(* *.my..Method());
>    before(): pc() {
>      System.out.println("advice");
>    }
> }
> 
> I expected the result to have in this examples the same behavior as if I
> would have specified a methodname "my*Method" with the output:
> advice
> method
> 
> Thanks,
> Stefan
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 


-- 
-- Adrian
adrian.colyer@xxxxxxxxx


Back to the top