diff --git a/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/MethodCallSymbolProvider.java b/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/MethodCallSymbolProvider.java index 5e7f10b..257554d 100644 --- a/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/MethodCallSymbolProvider.java +++ b/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/MethodCallSymbolProvider.java @@ -7,9 +7,9 @@ import org.eclipse.jdt.core.IClassFile; import org.eclipse.jdt.core.ICompilationUnit; +import org.eclipse.jdt.core.IField; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.ITypeRoot; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTParser; @@ -32,7 +32,7 @@ public List get(SearchMatch match) { // For Method Calls we will need to do the local variable trick try { MethodReferenceMatch m = (MethodReferenceMatch) match; - IMethod e = (IMethod) m.getElement(); + IJavaElement e = (IJavaElement) m.getElement(); SymbolInformation symbol = new SymbolInformation(); Location location = getLocation((IJavaElement) match.getElement(), match); symbol.setName(e.getElementName()); @@ -40,7 +40,13 @@ public List get(SearchMatch match) { symbol.setContainerName(e.getParent().getElementName()); symbol.setLocation(location); if (this.query.contains(".")) { - ICompilationUnit unit = e.getCompilationUnit(); + ICompilationUnit unit = null; + if (m.getElement() instanceof IMethod) { + unit = ((IMethod) m.getElement()).getCompilationUnit(); + } else if (m.getElement() instanceof IField) { + unit = ((IField) m.getElement()).getCompilationUnit(); + } + if (unit == null) { IClassFile cls = (IClassFile) ((IJavaElement) e).getAncestor(IJavaElement.CLASS_FILE); if (cls != null) {