Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Newbie question


Hi All,
        Just started using AspectJ on Friday last week and have being doing a bit of experimentation but have a quick question about the following pointcut definitions
 
// 1st
 pointcut setMethods(TestClass tc): target(tc) && call(public * set*(..)) && args(int);
 pointcut getMethods(TestClass tc): target(tc) && call(public * get*(..));
 pointcut methods(TestClass tc): (setMethods(tc) || getMethods(tc));
       
// 2nd
 pointcut setMethods(): call(public * set*(..)) && args(int);
 pointcut getMethods(): call(public * get*(..));
 pointcut methods(TestClass tc): target(tc) && (setMethods() || getMethods());

Now what I don't understand is why does the first version of methods work and the second one produce the following error

Cannot use target() to match at this location and bind to formal type 'TestClass' - the formal is already bound to 'TestClass'. The secondary source location points to the problematic target().
        -TestAspect.before(TestClass):methods..
        -TestAspect.after(TestClass):methods..

at the following code fragment

        tc.setValue(0);

From my understanding I think they should evaluate to the same thing. I am sure I am missing something some thing fundamental here.

Regards,
William Leeson
Software Development

PILZ Ireland Industrial Automation,
Business & Technology Park, Model Farm Road, Cork, Ireland.
Telephone +353 (021)  4804-982, Fax +353 (021) 4804-994
E-Mail: mailto:w.leeson@xxxxxxx, Internet: http://www.pilz.ie

This email is intended solely for the use of the named addressee(s). Any unauthorised disclosure, copying or distribution of the confidential information contained therein, or the taking of any action based on it, is prohibited. The sender disclaims any liability for the integrity of this email. Legally binding declarations must be in written form.

Back to the top