[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] AW: Concretize abstract pointcut with subtypes
|
Hi Charles.
If i got your point right, the reason why you cannot override
pointcuts with subtype arguments is the same as why you cannot
override methods with methods receiving subtype arguments:
class A {}
class B extends A // the subtype
{
void b() {} // this will trigger the problem
}
abstract class C
{
abstract void method(A a);
}
class D extends C
{
void method(B b) // supposed to override C.method(A)
{
b.b();
}
}
class E
{
A a = new A();
B b = new B();
C c = new D();
void e()
{
c.method(b); // allowed, would call b.b()
c.method(a); // syntactically allowed, but there is no a.b()!
}
}
Hope, this illustrates the problem well.
- Thomas
> -----Ursprungliche Nachricht-----
>
> Hi, Wes, thanks for the reply. What I'm trying to do is not to
> overload the pointcut, but using a subtype for the type used in
> abstract pointcut, just like in the case of any regular Java
> method. The reason for doing so is that I can write some generic
> advices to deal with supertypes and allow specific extensions. I
> know it is a syntactic error. I am just wondering if you know why
> this is prohibited. Thanks.
>
> Charles