[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Strange behaviour of declare parents
|
Hi,
First of all, is it true that `declare parents ... extends ...' and
`declare parents ... implements ...' are exactly the same? They seem to
be based on some tests i carried out. If so, why do the docs not mention
this?
Now, for the strange behaviour, consider the following AspectJ code:
class A { }
class B { }
class C { }
aspect Aspect {
declare parents: A extends B, C;
}
Listing two elements after extends seems odd. However, extends and
implements are interchangeable in this case (and i think in every case),
so it is technically acceptable. Still it seems to be an impossible
construct, since A, B and C are all classes and multiple inheritance is
not an option. But it compiles just fine. I used javap to get the results:
class A extends C { }
class B extends Object { }
class C extends Object { }
I did not expect this to happen. Am i missing something or is this a bug?
Note: if i split the declare parents line in two, like this:
aspect Aspect {
declare parents: A extends B;
declare parents: A extends C;
}
Then it does not compile and gives the errors one would expect.
Regards,
Pepijn Verlaan