Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] How to resolve method binding in advice declaration

We know the AspectJ Ast is incomplete. As users need features from it,
it is extended to handle them.  Sometimes the user who needs the new
feature implements it and adds it as a patch to a bugzilla report.
For example: https://bugs.eclipse.org/bugs/show_bug.cgi?id=168714 or
https://bugs.eclipse.org/bugs/show_bug.cgi?id=110465

You should at least raise a bug for this, but it's more likely to get
into the codebase if you also supply an implementation ;)

Andy.

On 13/10/2007, l_mousa@xxxxxxxxxxxxxxxxx <l_mousa@xxxxxxxxxxxxxxxxx> wrote:
> 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
>
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-dev
>


Back to the top