CDV ❯ DefinitionException thrown when visiting AspectJ woven classes
-
Bug
-
Status: Closed
-
2 Major
-
Resolution: Fixed
-
-
-
hhuynh
-
Reporter: teck
-
June 25, 2007
-
0
-
Watchers: 0
-
July 09, 2007
-
June 26, 2007
Attachments
Description
From the forums: http://forums.terracotta.org/forums/posts/list/293.page
This appears to be an issue caused by the AspectJ compiler. Best I can tell, the advice is transformed to a static method named “removeConnector_aroundBody9$advice” in the target class where the advice is to be applied. The LocalVariableTable for that static method though is copied wholesale from the original aspect defniotn. Unfortunately this information is completely wrong by this point (new method parameters have been added, and the method is now static). This bad local variable info is what trips the exception in the Terracotta code.
We’re going to report the problem to the AspectJ developers and work on making the Terracotta code tolerant of this scenario.
The exception is relatively harmless though, it is caught and printed.
Comments
Tim Eck 2007-06-25
Steve Harris 2007-06-25
If we can figure out in noriega great, otherwise we’ll move it out.
Tim Eck 2007-06-25
reported bug with AspectJ here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=194314
Eugene Kuleshov 2007-06-26
I’ve committed fix to the trunk and 2.4 branch. Parameter reader now recover from invalid classes and don’t spill stack traces with attached test project.
Fiona OShea 2007-06-28
Please verify that this is fixed.
here’s the original advice method.
@Around(“execution(void test.ConnectorService.removeConnector(long))”) public void removeConnector(ProceedingJoinPoint pjp) throws Throwable { System.out.println(“i Remove”); Object[] args = pjp.getArgs(); long id = (Long) args[0]; pjp.proceed(pjp.getArgs()); System.out.println(id); }
which turns into this where it is woven in (note LocalVariableTable at end):
private static final void removeConnector_aroundBody9$advice(test.ConnectorService, long, org.aspectj.lang.JoinPoint, test.ConnectorServiceInterceptor, org.aspectj.lang.ProceedingJoinPoint); Code: 0: getstatic #27; //Field java/lang/System.out:Ljava/io/PrintStream; 3: ldc #167; //String i Remove 5: invokevirtual #47; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 8: aload 5 10: invokeinterface #101, 1; //InterfaceMethod org/aspectj/lang/ProceedingJoinPoint.getArgs:()[Ljava/lang/Object; 15: astore 6 17: aload 6 19: iconst_0 20: aaload 21: checkcast #169; //class java/lang/Long 24: invokevirtual #172; //Method java/lang/Long.longValue:()J 27: lstore 7 29: aload 5 31: aload 5 33: invokeinterface #101, 1; //InterfaceMethod org/aspectj/lang/ProceedingJoinPoint.getArgs:()[Ljava/lang/Object; 38: astore 9 40: astore 10 42: aload_0 43: aload 9 45: bipush 0 47: aaload 48: invokestatic #119; //Method org/aspectj/runtime/internal/Conversions.longValue:(Ljava/lang/Object;)J 51: aload 10 53: invokestatic #179; //Method removeConnector_aroundBody8:(Ltest/ConnectorService;JLorg/aspectj/lang/JoinPoint;)V 56: aconst_null 57: pop 58: getstatic #27; //Field java/lang/System.out:Ljava/io/PrintStream; 61: lload 7 63: invokevirtual #174; //Method java/io/PrintStream.println:(J)V 66: return
LocalVariableTable: Start Length Slot Name Signature 0 67 0 this Ltest/ConnectorServiceInterceptor; 0 67 1 pjp Lorg/aspectj/lang/ProceedingJoinPoint; 17 50 2 args [Ljava/lang/Object; 29 38 3 id J