Bug 59196 - "adviceexecution() && args()" pcd does not pick up around advice execution because args() does not match the AroundClosure parameter.
Summary: "adviceexecution() && args()" pcd does not pick up around advice execution be...
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.2   Edit
Hardware: All All
: P4 normal (vote)
Target Milestone: 1.5.0 M4   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-20 03:42 EDT by devi prasad CLA
Modified: 2005-09-01 04:32 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description devi prasad CLA 2004-04-20 03:42:16 EDT
In the following sample, the advice defined in "other_aspect" does not pick up 
the execution of around advice defined in "some_aspect". It matches only 
against the before advice defined in "some_aspect".

The implicit AroundClosure parameter of an around advice seems to come in the 
way of args() matching. 

------------------------------------------------------ 
aspect some_aspect {
   pointcut call_m(int a, int b) : 
              call(int test.m(..)) && args(a, b);
 
   before(int x, int y) : call_m(x, y) { ...  }
   int around(int x, int y) : call_m(x, y) { ... }
}
 
aspect other_aspect {
   before(int x, int y) : 
       adviceexecution() && within(some_aspect) && 
                                       args(x, y){ 
         ...
       }
}
--------------------------------------------------------

AspectJ doc has to state this explicitly.
Comment 1 Erik Hilsdale CLA 2004-08-23 20:35:50 EDT
This is a bug, not a misdocumentation.  I've moved this back to compiler 
and cc'd myself on it in case I get enough time to fix the bug.  I've verified
that this is still a bug in 1.2 with the following test that I should check
in as a test case:

public class Test {
    public static void main(String[] args) {
	m(3, 4);
    }
    static void m(int x, int y) {
    }

}

aspect some_aspect {
   pointcut call_m(int a, int b) : 
              call(void Test.m(..)) && args(a, b);
 
   before(int x, int y) : call_m(x, y) { System.err.println("b4");  }
   void around(int x, int y) : call_m(x, y) { System.err.println("arn"); }
}
 
aspect other_aspect {
   before(int x, int y) : 
       adviceexecution() && within(some_aspect) && 
                                       args(x, y){ 
       System.err.println("exec");
       }
}

The args of an around advice should be the formal arguments listed, not
including the magic closure argument.

I've P4d the bug since I think it unlikely in the extreme that people
in the wild are using adviceexecution at all, much less with args.
Comment 2 Adrian Colyer CLA 2005-03-22 08:53:08 EST
marked as target AJ5 M4
Comment 3 Adrian Colyer CLA 2005-09-01 04:32:45 EDT
fixed in tree, fix will be available in next published build on AspectJ download page later on today.