Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] exception during compilation

Anyone have any thoughts about this?

On Mon, Mar 5, 2012 at 11:14 AM, Steve Ash <stevemash@xxxxxxxxx> wrote:
I'm trying to build two aspects such that one or the other will be woven depending on a boolean value in an attribute.  So if logArgs is true then it will weave TraceAspect and if logArgs is false it will weave TraceWithoutArgsAspect.

@Trace(logArgs=true)
public void someMethod(String someArg) {
   ...
}

And I have the aspects setup like so:

public abstract aspect AbstractTraceAspect {

    abstract pointcut MethodsToLog();
   
    pointcut MethodsMarkedTraceAndLevel(TraceLevel level) :
        MethodsToLog() && @annotation(Trace(level));

}

public aspect TraceWithoutArgsAspect extends AbstractTraceAspect {

    pointcut MethodsToLog() : execution(@Trace(logArgs=false) * *.*(..));

    before(TraceLevel level) : MethodsMarkedTraceAndLevel(level) {
       ...
    }
    ...
}

Note that my annotation definition is like:

public @interface Trace {
    TraceLevel value() default TraceLevel.INFO;
    boolean logArgs() default true;
}
   
Everything works wonderfully with AJDT -- everything compiles all of my unit tests work perfectly.  The correct aspect is woven and the behaviors work as expected.

When I try to do a maven build, it blows up in the compiler producing the dump which I have attached.

Here is the beginning of the stack trace from the compiler (for future googlers):

[ERROR] -- (RuntimeException) Dont call getValueString() on a non STRING ElementValue
[ERROR] Dont call getValueString() on a non STRING ElementValue
[ERROR] java.lang.RuntimeException: Dont call getValueString() on a non STRING ElementValue
[ERROR] at org.aspectj.apache.bcel.classfile.annotation.SimpleElementValue.getValueString(SimpleElementValue.java:204)
[ERROR] at org.aspectj.weaver.bcel.AnnotationAccessFieldVar.appendLoadAndConvert(AnnotationAccessFieldVar.java:79)
[ERROR] at org.aspectj.weaver.bcel.BcelAdvice.getAdviceArgSetup(BcelAdvice.java:605)
[ERROR] at org.aspectj.weaver.bcel.BcelAdvice.getAdviceInstructions(BcelAdvice.java:476)
[ERROR] at org.aspectj.weaver.bcel.BcelShadow.weaveBefore(BcelShadow.java:1667)
[ERROR] at org.aspectj.weaver.bcel.BcelAdvice.implementOn(BcelAdvice.java:316)
[ERROR] at org.aspectj.weaver.Shadow.implementMungers(Shadow.java:630)
[ERROR] at org.aspectj.weaver.Shadow.implement(Shadow.java:544)
[ERROR] at org.aspectj.weaver.bcel.BcelClassWeaver.implement(BcelClassWeaver.java:3147)

I have tried this with the 1.6.11 release, the 1.6.12 release, and the 1.7.0 snapshot build from the spring repo and all fail with this. 

Here are my AJDT version numbers:

   AJDT version: 2.2.0.e37x-20120302-1100
   AspectJ Compiler version: DEVELOPMENT


Any clues as to what going wrong here?

Thanks,

Steve Ash


Back to the top