[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Aspects and overridden methods
|
Hi!
According to JoinPoint Signature (described here [1])
for method execution jp-s:
[quote]
There is one signature for each type that provides its own declaration of the method.
[/quote]
and considering the pointcut matching rules (stated here [2])
[quote]
# They are of the same kind
# The signature pattern (exactly) matches at least one signature of the join point
# The modifiers pattern matches the modifiers of the subject of the join point
[/quote]
I think that your execution pointcut matching is correct.
Applying the same rules to the call pointcut, I think this is again correct.
Do these make any sense to you?
cheers,
./alex
--
.w( the_mindstorm )p.
[1] http://www.eclipse.org/aspectj/doc/next/adk15notebook/join-point-signatures.html
[2] http://www.eclipse.org/aspectj/doc/next/adk15notebook/jpsigs.html#join-point-matching
#: apel@xxxxxxxxxxxxxxxxxxxxxxx changed the world a bit at a time by saying on 9/30/2005 7:38 PM :#
Hi,
I have a problem with the following code example:
class Parent
{
public void foo()
{
System.out.println("Parent::foo()");
}
}
class Child extends Parent
{
public void bar()
{
System.out.println("Child::bar()");
}
public void foo()
{
System.out.println("Child::foo()");
super.foo();
bar();
}
}
aspect ParentAspect
{
pointcut to_foo() : execution(void Parent.foo());
after() : to_foo()
{
System.out.println("after calling: " + thisJoinPoint.getSignature());
}
}
When compling this example and executing the following main:
public static void main(String[] args)
{
Child c = new Child();
c.foo();
}
... I get this output:
Child::foo()
Parent::foo()
after calling: void Parent.foo()
Child::bar()
after calling: void Child.foo()
Obviously the pointcut matches both foo() methods, although I wanted to
match only Parent.foo(). When trying a call instead the execution pointcut
the result is that Child.foo() is matched only (which is clearly not
intended):
Child::foo()
Parent::foo()
Child::bar()
after calling: void Child.foo()
For both cases (execution and called) I had expected that only the
Parent.foo() method was matched. Am I thinking wrong? To my opinion there
must be a possibility to match only the Parent.foo() method without using
the within pointcut, etc. (Imaging the Child class is added subsequently,
in a later development step.)
thanks in advance
Sven
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users