[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[aspectj-users] Parameter construction pointcut?
- From: "Seva Popov" <seva_popov@xxxxxxxxxxx>
- Date: Fri, 10 Aug 2007 10:56:46 -0700
- Delivered-to: email@example.com
- Thread-index: Acfbd9FlJU1pVXzfQf6UvyJw1oBA0Q==
- Thread-topic: Parameter construction pointcut?
We have a lot of debug statements in our code base like this:
logger.debug("Entry number: " + i + " is " + String.valueOf(entry[i]));
i.e. the parameters are constructed even when there's no output to the
So, in order to improve the performance without fixing the code I was
thinking about creating an aspect that would enforce the call to the
logger.isDebugEnabled() before any logger.debug() statement.
But it seems the AspectJ can't help me in this case. The fact is you
can't set an advice around logger.debug() to avoid the String.valueOf()
and string concats anyways because those are called before
Please, confirm my assumptions or suggest me any solutions besides
fixing the code itself.
P.S. I understand that AspectJ operates on the bytecode but not on the
source code. But is it theoretically possible to augment the AspectJ
with a parameter construction pointcut? Just curious.