Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Pointcut fails to match when arguments combined with ".."

Observer the following pointcut and advice which is supposed to match
all calls to Logger.log(..).  Logger.log always takes a Level as the
first parameter.  However the advice never gets applied.

   pointcut logCall(Level p) : target(Logger) && args(p) &&
!within(LoggingAspect) && call(void log(..));
   before(Level p) : logCall(p) {
       Errors.add(p);
   }

If I revise the pointcut and advice as follows it does get applied.
AspectJ seems to be getting confused when trying to use arguments and
specifying additional optional arguments using wildcards.

pointcut logCall() : target(Logger) && !within(LoggingAspect) &&
call(void(log(..));
before() : logCall() {
   dummy();
}

What's the scoop?  I've also tried the following and it doesn't match
either:

   pointcut logCall(Level p) : target(Logger) && args(p) &&
!within(LoggingAspect) && call(void log(Level, ..));
   before(Level p) : logCall(p) {
       Errors.add(p);
   }







Back to the top