Community
Participate
Working Groups
From the mailing list, this goes wrong: ***R.java*** public class R{ public static void main(String[] args) {System.out.println(new R().getClass().getName());} } ***R1.java*** public class R1 extends R {} ***RAj.aj*** public aspect RAj { private ThreadLocal<Object> inAspect = new ThreadLocal<Object>(); pointcut createR() : execution(R.new()); Object around() : createR() { System.out.println("aspect:" + inAspect.get() + ":" + this); if (inAspect.get() != null) { return proceed(); } else { inAspect.set(this); return new R1(); } } } compile command: /cygdrive/c/Program\ Files/Java/aspectj-1.6.12/bin/ajc.bat -source 1.7 -outxml -outjar araj.jar -classpath "aspectjrt.jar;." RAj.aj run: /cygdrive/c/Program\ Files/Java/aspectj-1.6.12/bin/aj5.bat -classpath ".;./araj.jar" R errors: Apr 06, 2012 1:37:40 PM org.aspectj.weaver.tools.Jdk14Trace error SEVERE: register definition failed java.lang.RuntimeException: Problem processing attributes in RAj at org.aspectj.weaver.bcel.BcelObjectType.ensureAspectJAttributesUnpacked(BcelObjectType.java:385)
this is caused by asm trying to be too clever for its own good and damaging the constant pool when it adds the stack map entries. This leaves us with attributes that refer to constant pool entries that have 'moved'.
There is a way to turn off this asm behaviour by passing the classreader into the classwriter. I've done this and the exception is fixed.