Search code examples
aopaspectjserializabledeclareparents

AOP declare parents not working correctly in multiple inheritance


I have 2 classes: A,B. And A extends from B. In my aspect I'm trying to declare parents for A and B to implements Serializable.

But for some reason, only B implements Serializable and A doesn't. (See the orange arrow that is only on B)

image

If I switch the order between those lines, now A implements Serializable, and B doesn't. (See the orange arrow that is only on B)

image

Why this is happening? How can I make both of them implements Serializable?

I'm working on Eclipse Luna 4.4.2 with AspectJ 1.8.7.


Solution

  • Since A extends B, A inherits all implemented interfaces of it's superclass B. The declaration declare parents: A implements Serializable; hence does nothing, since A already implements Serializable through B.