Question

I need to find if a given method is present in the given java class. I have the IMethod object. I am using the below code to do this.

getMethod.exists();

for a java class in the project (Source Type), it works fine.

When the class is in a jar i.e. a Binary type I am getting the below exception. Is there any other way to find is the method exists in a class present in a jar.

java.lang.NullPointerException
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:539)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:255)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:241)
at org.eclipse.jdt.internal.core.JavaElement.exists(JavaElement.java:159)
Était-ce utile?

La solution

Looks like Eclipse bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=402455 marked as a duplicate of https://bugs.eclipse.org/bugs/show_bug.cgi?id=400559 which is closed as 'not eclipse' and blames groovy-eclipse for doing something wrong (but doesn't say what!)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top