[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Compile-time signature

The proper optimization here is to use the LDC byte code that takes a constant class, rather than the string variant and then class loading. The original AspectJ used the string form because LDC didn't take a class originally. Over the years a few places have been updated but not everywhere ( thisEnclosingJoinPoint is one of them that hasn't been done I think). Let me have a look at what I can do. For a while we had to tolerate both modes because LDC class was quite new, but it has been there so long now I think we can assume you are on a JVM that will have it.


On 10 January 2018 at 01:42, Fabian Bergmark <fabian.bergmark@xxxxxxxxx> wrote:
I'm using both AspectJ and Proguard in a project. On of my aspects
inserts MDC-information in logging messages, including source location
and method:

void around() : call(void org.slf4j.Logger.trace(..)) || call(void
org.slf4j.Logger.debug(..)) || call(void org.slf4j.Logger.info(..)) ||
call(void org.slf4j.Logger.warn(..)) || call(void
org.slf4j.Logger.error(..)) {
    try (MDC.MDCCloseable c3 =
       MDC.MDCCloseable c4 =
thisEnclosingJoinPointStaticPart.getSignature().toString())) {

However, when enabling obfuscation in proguard, this results in log
messages like:

"mdc" : {
  "logging_aspect::method" : "void
CreateConnectionChannelError, ConnectionStatus)",
  "logging_aspect::location" : "File.java:299"

I think there should be a way to access the Signature at the time of
compilation. This would also be faster (?) than looking up classes
during runtime.
aspectj-users mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit