From e25332f90b91a8a1cc07ba1491247f9c7e1ca115 Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Thu, 31 Oct 2024 16:05:54 -0400 Subject: [PATCH] Fix NPE Signed-off-by: Rob Stryker --- .../jdt/internal/core/search/matching/MatchLocator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);