Summary: | [plan] [ataspectj] BCException when @Around is uncommented - if() related | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Barry Kaplan <groups1> |
Component: | Compiler | Assignee: | aspectj inbox <aspectj-inbox> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | aclement, groups1 |
Version: | 1.5.2 | ||
Target Milestone: | 1.6.3 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Barry Kaplan
2006-10-24 15:23:31 EDT
Actually, the error appears to be releated to the if() in the exceptionInitializer pointcut. If I remove the "&& if()" and change the signature the error is eliminated (with the full @Around adviced uncommented) thanks for the small testcase - I have recreated this. I'd probably use code style aspects if I were you, the if() support in annotation style is a bit buggy. Thanks for recreating! Too bad about @Aspect if()'s. We are using only @Aspect syntax. Is there a category/search criteria for @Aspect specific bugs so I can be on the lookout for gotchas? tests for this have been committed (they are currently commented out in Ajc153tests) ok, the problem here is the parameter binding is hopeless for annotation style. Here is the pointcut (highlights): @Pointcut("call(...) && this(caller) && args(exceptionMessage) && if()") public static boolean foo(Object caller, String exceptionMessage) { and here is the advice method (highlights): @Around("foo(caller, exceptionMessage)") public Object goo(ProceedingJoinPoint jp, Object caller, String exceptionMessage) { Code style does a lot of analysis to bind things correctly. Here the binding of caller and exceptionmessage for passing to them to foo() gets completely thrown by the addition of ProceedingJoinPoint in the advice method. In the end it kind of attempts to pass ProceedingJoinPoint and caller as the two parameters to foo. And blows up as shown. So I've made this situation work now. It is is still fragile but the rules are relatively straightforward - the parameter ordering for the if() must match the order in goo() but you are allowed special parameters ahead of the normal parameters (like ProceedingJoinPoint above). I've added 6 testcase variants for this and they are all OK. It will be easy to break it by violating this rule but at least a well written pointcut/advice pair will work as expected now. |