[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Aspects and overridden methods

Hi Valerio,

I think something like that would work. I could also use the within
pointcut to limit the matched set of joinpoints to the Parent class. The
main point is that I do not want to do that. Imagine I have a program that
only consists of the Parent class and the aspect (see previous mail for
the source). In this I case I usually use this simple pointcut: pointcut
to_foo() : execution(void Parent.foo()); I think the most programmers will
use such or a related pointcut. Imagine that I want to add in a later
development stage the Child class that extends the foo() method. Such a
situation is common in oo design. Adding this class alters the behavior of
my program dramatically. Using the execution pointcut both foo() methods,
of Child and of Parent are matched, although I only want to match the one
of Parent. Using a call pointcut instead only the Child.foo() method is
matched which is clearly not intended. So is that a general problem of
AspectJ, is this intended? Or have I doing/understanding something wrong?


> Hello,
> apel@xxxxxxxxxxxxxxxxxxxxxxx ha scritto:
>>aspect ParentAspect
>>    pointcut to_foo() : execution(void Parent.foo());
>>	after() : to_foo()
>>	{
>>    	System.out.println("after calling: " +
>> thisJoinPoint.getSignature());
>>	}
> try this pointcut:
> pointcut to_foo() : execution(void (Parent && !Parent+).foo());
> i can't try it myself, but may give you a clue.
> valerio
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users