WALA: Nullpointerexception in JDTJava2CAstTranslator

Hello,

I’m trying to create a call graph but encounter a null pointer exception. Depending on the java source I use as input the exception is thrown from different visitors, but it always involves “n.resolveMethodBinding()”.

resolveMethodBinding returns null because it uses the class BindingResolver’s implementation (org.eclipse.jdt.core.dom package) (line 194):

    IMethodBinding resolveMethod(MethodInvocation method) {
        return null;
    }

It is likely that DefaultBindingResolver should be used instead of BindingResolver’s which features an empty implementation for each method.

The exact same issue was described by someone else here: https://sourceforge.net/p/wala/mailman/message/34746738/

Hope you have any clue how to solve this issue, as I’m using this tool for research done with regard to my thesis.

Best regards, Edward

About this issue

  • Original URL
  • State: open
  • Created 8 years ago
  • Reactions: 1
  • Comments: 52 (19 by maintainers)

Most upvoted comments

@edwardmp I am facing the same (original) problem that @msridhar posted in this thread. In fact, I am getting exactly the same stacktrace of the null pointer exception.

The problem, surprise surprise, is that resolveMethodBinding() is returning null. It is caused by the invocation of a method in a class in a JAR file included in my project. So far, I have tried the following solutions without success:

  • Made sure all Java standard libraries (including rt.jar) are included
  • Updated the Eclipse JDT libraries to the latest version (3.12 released in Feb 2017)
  • Tried with different versions of Java (7 and 8)
  • Set the ASTParser properties as suggested here

All other bindings seem to be working fine (even those with invocations of other methods in the same class) and I have no clue why this specific one is failing. Do you have any idea what might be causing it?