Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » AspectJ and method overriding
AspectJ and method overriding [message #70145] Wed, 11 July 2007 09:45 Go to next message
Mickael GAUVIN is currently offline Mickael GAUVINFriend
Messages: 39
Registered: July 2009
Member
Hello,

I'm working on a project where OSGi mecanism is hidden in Aspects.

I have somme problem with methods overriding. Currently I have 2
interfaces A and B, B inheriting from A. I have the interface
ServiceListener provided by OSGi framework. All objects implementing A
and B must implement ServiceListener so they must have the method
serviceChanged(ServiceEvent event) implemented.

Here it is my two aspects :

aspect A {

declare parents: A implements ServiceListener;

public void A.serviceChanged(ServiceEvent evt) {
// Beginning of A treatment
...
// End of A treatment
}

}

aspect B {

declare parents: B implements ServiceListener;

public void B.serviceChanged(ServiceEvent evt) {
// Beginning of A treatment
...
// End of A treatment

// Beginning of B treatment
...
// End of B treatment
}

}

As I wish B execute the same code of A (its parent), I'm obliged to
rewrite all the A treatment. To avoid this useless recopy I wanted to
use the key word "super" to obtain this B aspect:

aspect B {

declare parents: B implements ServiceListener;

public void B.serviceChanged(ServiceEvent evt) {
-> super.serviceChanged(evt);

// Debut traitment B
...
// Fin traitement B
}

}

but that code doesn't work, surely because here, super is interpreted as
the aspect B parent that is Object and not as the B parent that is A.

If you have any help for this problem, I will be happy.

Thanks

Mickaël Gauvin
Re: AspectJ and method overriding some errors in my Aspects Name [message #70165 is a reply to message #70145] Wed, 11 July 2007 12:14 Go to previous message
Mickael GAUVIN is currently offline Mickael GAUVINFriend
Messages: 39
Registered: July 2009
Member
Escuse me, some errors exist in my code : I have replace my aspects A
and B name respectively by MyAspectA and MyAspectB to avoid confusing
with my interfaces

aspect MyAspectA {

declare parents: A implements ServiceListener;

public void A.serviceChanged(ServiceEvent evt) {
// Beginning of A treatment
...
// End of A treatment
}

}

aspect MyAspectB {

declare parents: B implements ServiceListener;

public void B.serviceChanged(ServiceEvent evt) {
// Beginning of A treatment
...
// End of A treatment

// Beginning of B treatment
...
// End of B treatment
}

}
Re: AspectJ and method overriding some errors in my Aspects Name [message #596174 is a reply to message #70145] Wed, 11 July 2007 12:14 Go to previous message
Mickael GAUVIN is currently offline Mickael GAUVINFriend
Messages: 39
Registered: July 2009
Member
Escuse me, some errors exist in my code : I have replace my aspects A
and B name respectively by MyAspectA and MyAspectB to avoid confusing
with my interfaces

aspect MyAspectA {

declare parents: A implements ServiceListener;

public void A.serviceChanged(ServiceEvent evt) {
// Beginning of A treatment
...
// End of A treatment
}

}

aspect MyAspectB {

declare parents: B implements ServiceListener;

public void B.serviceChanged(ServiceEvent evt) {
// Beginning of A treatment
...
// End of A treatment

// Beginning of B treatment
...
// End of B treatment
}

}
Previous Topic:AspectJ and method overriding
Next Topic:newbie: how to export as jar
Goto Forum:
  


Current Time: Fri Apr 19 23:42:28 GMT 2024

Powered by FUDForum. Page generated in 0.03306 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top