This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Java Products and Servers and the fly likes AspectJ MethodSignature Returns Null Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "AspectJ MethodSignature Returns Null Method" Watch "AspectJ MethodSignature Returns Null Method" New topic
Author

AspectJ MethodSignature Returns Null Method

Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Hi. I'm relatively new to AspectJ (used in the past, but not for a while, so I'm a little bit rusty). I've setup a pointcut to catch all method calls, which it does, and then in the advice, I'm trying to print out the actual method that was called. I can do that using the following: thisJoinPoint.getSignature().toString() and that works just fine. However, I'm trying to get the underlying Method object, with thisJoinPoint.getSignature().getMethod(), and the method sometimes returns null when the signature is not null. Can anyone explain why this is happening?

Thanks,
Jeff
Timo Meinen
Greenhorn

Joined: Dec 02, 2005
Posts: 2
You can get the Method by



I have the same problem when the method is inherited from a superclass. Then the method is null. It's strange, because using the same technique with fields works just fine with inherited fields.

Did you find a solution for the problem?

There is a bug on eclipse for this purpose: https://bugs.eclipse.org/bugs/show_bug.cgi?id=154427

Thank you. Timo
timomeinen@gmail.com

[ October 24, 2007: Message edited by: Timo Meinen ]
[ October 24, 2007: Message edited by: Timo Meinen ]
 
Don't get me started about those stupid light bulbs.
 
subject: AspectJ MethodSignature Returns Null Method
 
Similar Threads
Debugging in Java
AspectJ: catch and handle exception using aspectJ
AspectJ MethodSignature Returns Null Method
AspectJ question
Method invocation _after_ ending of another method