5 Replies Latest reply on Mar 30, 2009 5:32 AM by kabirkhan

    Pointcut intercepting methods with annotated arguments

      Is it possible to write a pointcut to intercept execution of some method which has some of its arguments annotated with certain annotation. For example method declared as follows:

      void someMethod(@SomeAnnotation String arg1) {...}

      It would be nice if pointcut like this would be possible:

      execution(* *->*(@SomeAnnotation *))

      or even better:

      execution(* *->*(.., @SomeAnnotation *, ..)) - it would mean, that pointcut should match execution of any method with any of its arguments being annotated with @SomeAnnotation.

      If such pointcut worked it would be trivial to implement an aspect checking not null conditions on method arguments:
      void exampleMethod(String nullable, @NotNull String notNullable) {...}

      Regards
      Jarek