Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] NPE with @args

Andy Clement schrieb:
Right.... last spam from me on this....  I've looked at the bug report
and can see a failure when the program is in a package.

However, I should have said in the first place that you cannot do
parameter annotation matching with @args(), that is for matching an
annotation on the type of the parameter.

@Foo
class MyAnnotatedType {}

public void m(MyAnnotatedType mat) {}

execution(* *.m(..)) && @args(Foo) // will match m

The only way to match parameter annotations is to use the syntax I
showed earlier:

public void m(MyAnnotatedType mat) {}
public void m2(@Foo String s) {}

execution(* *.m*(@Foo (*)))  // will only match m2

ah, I see now, what I did wrong. My first try was

    execution(* *.m*(@Foo *))

(without the inner bracket) but this does not match the pointcut (I got a warning for that).


For more information, see the 1.6.0 readme:
http://www.eclipse.org/aspectj/doc/released/README-160.html

I was not aware of the different meaning for an annotation before a parameter in the AspectJ syntax. Now I know why the pointcut above (and my first try) do not match.

Thanks for your clarification
Oliver



Back to the top