Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] parameter evaluation and advice

Consider the following advice:

    void around(Logger aLog) :
        call(public * Logger.debug(..))
        && target(aLog)  {
            if (aLog.isDebugEnabled()) {
                proceed(aLog);
            } 
        }

This advice works as expected - it prevents calls to log.debug(myString) from executing if log is
not debugEnabled.  

However, testing for a side effect on myString or examining byte code reveals that the parameter
to the debug() method ('myString') is being evaluated, even if log is not debugEnabled and
proceed() is never called.

I'm not familiar with how AspectJ is implemented, but... is there a way to prevent parameter
evaluation in this example?  

Thanks,
Peter Kalmus

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


Back to the top