Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » How to resolve method binding in advice declaration
How to resolve method binding in advice declaration [message #596408] Sat, 13 October 2007 19:21 Go to next message
Laleh is currently offline LalehFriend
Messages: 10
Registered: July 2009
Junior Member
Hello,

I am trying to get the information like metho- name, method-parameters and
the type (class) the method belongs to, from the MethodInvocation node in
the AdviceVisitor. The problem is that I can get just the method name and
its arguments, but I cannot get the arguments' type or the type which this
method belong to. Even when I try to resove binding for the method, I get
exception.

Here is my code:

public class AdviceVisitor extends AjASTVisitor {

// some code..

public boolean visit(MethodInvocation node) {
ITypeBinding type = node.getExpression().resolveTypeBinding();
IMethodBinding method=node.resolveMethodBinding();
if (type != null && method != null) {
ITypeBinding[] params = method.getParameterTypes();
if (params != null) {
for (int i = 0; i < params.length; i++) {
parameters=params[i].getName();
}
}
}
// some code ..
return true;
}}

It seems that type and the method are "null" and then I get
"java.lang.NullPointerException". Can any one help me to resolve this
problem?

Thanks,

Laleh
icon5.gif  Re: How to resolve method binding in advice declaration [message #1726331 is a reply to message #596408] Fri, 11 March 2016 13:50 Go to previous message
Moxin Chen is currently offline Moxin ChenFriend
Messages: 1
Registered: March 2016
Junior Member
Hello, I'm a college student and I'm working on a project in which I used jdt to parse traverse java projects. However, recently I am trouble by the same problem as you had encountered. I receive NPE while using "resolveMethodBinding" on MethodInvocation. Have you already solved your problem? Could you give me some help? Thanks a lot. Embarrassed Embarrassed
Previous Topic:Accessing Method Parameters or return value of a method
Next Topic:Avoid executing aspects inside another aspect
Goto Forum:
  


Current Time: Thu Apr 25 22:43:21 GMT 2024

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

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

Back to the top