[
https://jira.terracotta.org/jira//browse/CDV-310?page=comments#action_21650 ]
Tim Eck commented on CDV-310:
-----------------------------
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
> DefinitionException thrown when visiting AspectJ woven classes
> --------------------------------------------------------------
>
> Key: CDV-310
> URL: https://jira.terracotta.org/jira//browse/CDV-310
> Project: Community Development
> Issue Type: Bug
> Affects Versions: 2.3
> Reporter: Tim Eck
> Assigned To: Eugene Kuleshov
> Attachments: Test.zip
>
>
> 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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.terracotta.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev