Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » cast thisJoinPoint to ProceedingJoinPoint
cast thisJoinPoint to ProceedingJoinPoint [message #72724] Mon, 17 November 2008 13:04 Go to next message
Hao Missing name is currently offline Hao Missing nameFriend
Messages: 115
Registered: July 2009
Senior Member
Hi

I would like to write a function such that several round advices can call.
Inside the function proceed() method needs to be called. Can I cast
thisJoinPoint to ProceedingJoinPoint and pass it to the function within
round advice?

thanks
Re: cast thisJoinPoint to ProceedingJoinPoint [message #72750 is a reply to message #72724] Tue, 18 November 2008 08:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: erdal.karaca.airbus.com

Even if you cast to ProceedingJoinPoint, this will not work (at least not
in ajdt 1.5).

My workaround for this:

void around(): ... {
Runnable proceed = new Runnable() {
public void run() {
proceed();
}
};

myFunction( proceed );
}

void myFunction( Runnable proceedingJoinPoint ) {
...
proceed.run();
}

I analysed this a while ago and I came to the conclusion that there were
something unbound (maybe a bug), such that
ProceedingJoinPoint.proceed(...) will fail when just cast from a
JoinPoint...
Re: cast thisJoinPoint to ProceedingJoinPoint [message #72796 is a reply to message #72750] Tue, 18 November 2008 22:15 Go to previous message
Hao Missing name is currently offline Hao Missing nameFriend
Messages: 115
Registered: July 2009
Senior Member
That's an acceptable approach.

thanks!
hao
Re: cast thisJoinPoint to ProceedingJoinPoint [message #599375 is a reply to message #72724] Tue, 18 November 2008 08:44 Go to previous message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 18
Registered: July 2009
Junior Member
Even if you cast to ProceedingJoinPoint, this will not work (at least not
in ajdt 1.5).

My workaround for this:

void around(): ... {
Runnable proceed = new Runnable() {
public void run() {
proceed();
}
};

myFunction( proceed );
}

void myFunction( Runnable proceedingJoinPoint ) {
...
proceed.run();
}

I analysed this a while ago and I came to the conclusion that there were
something unbound (maybe a bug), such that
ProceedingJoinPoint.proceed(...) will fail when just cast from a
JoinPoint...
Re: cast thisJoinPoint to ProceedingJoinPoint [message #599438 is a reply to message #72750] Tue, 18 November 2008 22:15 Go to previous message
Hao Missing name is currently offline Hao Missing nameFriend
Messages: 115
Registered: July 2009
Senior Member
That's an acceptable approach.

thanks!
hao
Previous Topic:What arguments should be passed to ProceedingJoinPoint
Next Topic:using Ajeer for RCP based on eclipse 3.2.3
Goto Forum:
  


Current Time: Thu Apr 25 17:56:22 GMT 2024

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

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

Back to the top