diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java index 37fed89d522..fe4f08044d2 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java @@ -1476,7 +1476,9 @@ private SearchMatch toMatch(org.eclipse.jdt.core.dom.ASTNode node, int accuracy, } if (node instanceof MethodInvocation method) { IJavaElement enclosing = DOMASTNodeUtils.getEnclosingJavaElement(node.getParent()); - return new MethodReferenceMatch(enclosing, accuracy, method.getName().getStartPosition(), method.getStartPosition() + method.getLength() - method.getName().getStartPosition(), false, method.resolveMethodBinding().isSynthetic(), false, insideDocComment(node), getParticipant(), resource); + IMethodBinding mb = method.resolveMethodBinding(); + boolean isSynthetic = mb != null && mb.isSynthetic(); + return new MethodReferenceMatch(enclosing, accuracy, method.getName().getStartPosition(), method.getStartPosition() + method.getLength() - method.getName().getStartPosition(), false, isSynthetic, false, insideDocComment(node), getParticipant(), resource); } if (node instanceof SuperMethodInvocation method) { return new MethodReferenceMatch(DOMASTNodeUtils.getEnclosingJavaElement(node.getParent()), accuracy, method.getName().getStartPosition(), method.getStartPosition() + method.getLength() - method.getName().getStartPosition(), false, method.resolveMethodBinding().isSynthetic(), true, insideDocComment(node), getParticipant(), resource);