Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] java.lang.VerifyError with int arguments in around advice?

does the problem still occur if you use code style rather than
annotation style aspects?


On 26/02/07, B.li@xxxxxxx <B.li@xxxxxxx> wrote:
I'm trying to use AspectJ for debug logging where the developer doesn't
have to specify the method names, class names, etc. when calling the
debug method. I created some empty "stub" methods that developers can
call to log a message. I then decleared call pointcuts on these stub
methods which are adviced by an Around advice. The advice is where all
the work of actually logging the messages are done.

Stub methods:

public class TraceLogger extends Logger
{
....
  public static void debugMessage(LogLevel level, int msgID)
  {}
....
}

Aspect:

@Aspect("pertypewithin(*)")
public class Tracer
{
....
  @Pointcut("call(public static void
org.opends.server.loggers.debug.TraceLogger.debugMessage(..))")
  private void logMessageMethod()
  {
  }
....
  @Around("shouldTrace() && logMessageMethod() && args(level, msgID)")
  public void traceMessage(JoinPoint.EnclosingStaticPart
thisEnclosingJoinPointStaticPart,
                           LogLevel level, int msgID)
  {
    /* code to actually log the message */
  }
....
}

With this setup, I get the following error when I start the app:

Exception in thread "main" java.lang.VerifyError: (class:
org/opends/server/loggers/debug/Tracer, method: traceMessage signature:
(Lorg/aspectj/lang/JoinPoint$EnclosingStaticPart;Lorg/opends/server/loggers/LogLevel;I)V)
Expecting to find object/array on stack
        at org.opends.server.tools.ConfigureDS.<clinit>(ConfigureDS.java:1)

Interestingly, if I change the Around advice to a Before advice, the
error goes away.

Any thoughts?

Thanks
Bo
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top