|
54 | 54 | import org.eclipse.jdt.core.dom.ConstructorInvocation; |
55 | 55 | import org.eclipse.jdt.core.dom.CreationReference; |
56 | 56 | import org.eclipse.jdt.core.dom.EnumConstantDeclaration; |
| 57 | +import org.eclipse.jdt.core.dom.ExpressionMethodReference; |
57 | 58 | import org.eclipse.jdt.core.dom.FieldDeclaration; |
58 | 59 | import org.eclipse.jdt.core.dom.IBinding; |
59 | 60 | import org.eclipse.jdt.core.dom.IMethodBinding; |
|
70 | 71 | import org.eclipse.jdt.core.dom.SingleMemberAnnotation; |
71 | 72 | import org.eclipse.jdt.core.dom.SuperConstructorInvocation; |
72 | 73 | import org.eclipse.jdt.core.dom.SuperMethodInvocation; |
| 74 | +import org.eclipse.jdt.core.dom.SuperMethodReference; |
73 | 75 | import org.eclipse.jdt.core.dom.Type; |
| 76 | +import org.eclipse.jdt.core.dom.TypeMethodReference; |
74 | 77 | import org.eclipse.jdt.core.dom.VariableDeclaration; |
75 | 78 | import org.eclipse.jdt.core.dom.VariableDeclarationFragment; |
76 | 79 | import org.eclipse.jdt.core.dom.VariableDeclarationStatement; |
@@ -372,6 +375,39 @@ private SearchMatch toCoreMatch(MatchLocator locator, org.eclipse.jdt.core.dom.A |
372 | 375 | res.setLocalElement(DOMASTNodeUtils.getLocalJavaElement(node)); |
373 | 376 | return res; |
374 | 377 | } |
| 378 | + if (node instanceof ExpressionMethodReference method) { |
| 379 | + IJavaElement enclosing = DOMASTNodeUtils.getEnclosingJavaElement(node.getParent()); |
| 380 | + IMethodBinding mb = method.resolveMethodBinding(); |
| 381 | + boolean isSynthetic = mb != null && mb.isSynthetic(); |
| 382 | + var res = new MethodReferenceMatch(enclosing, accuracy, method.getName().getStartPosition(), |
| 383 | + method.getStartPosition() + method.getLength() - method.getName().getStartPosition(), false, |
| 384 | + isSynthetic, (accuracy & PatternLocator.SUPER_INVOCATION_FLAVOR) != 0, insideDocComment(node), getParticipant(locator), resource); |
| 385 | + res.setRaw(mb != null && mb.isRawMethod()); |
| 386 | + res.setLocalElement(DOMASTNodeUtils.getLocalJavaElement(node)); |
| 387 | + return res; |
| 388 | + } |
| 389 | + if (node instanceof TypeMethodReference method) { |
| 390 | + IJavaElement enclosing = DOMASTNodeUtils.getEnclosingJavaElement(node.getParent()); |
| 391 | + IMethodBinding mb = method.resolveMethodBinding(); |
| 392 | + boolean isSynthetic = mb != null && mb.isSynthetic(); |
| 393 | + var res = new MethodReferenceMatch(enclosing, accuracy, method.getName().getStartPosition(), |
| 394 | + method.getStartPosition() + method.getLength() - method.getName().getStartPosition(), false, |
| 395 | + isSynthetic, (accuracy & PatternLocator.SUPER_INVOCATION_FLAVOR) != 0, insideDocComment(node), getParticipant(locator), resource); |
| 396 | + res.setRaw(mb != null && mb.isRawMethod()); |
| 397 | + res.setLocalElement(DOMASTNodeUtils.getLocalJavaElement(node)); |
| 398 | + return res; |
| 399 | + } |
| 400 | + if (node instanceof SuperMethodReference method) { |
| 401 | + IJavaElement enclosing = DOMASTNodeUtils.getEnclosingJavaElement(node.getParent()); |
| 402 | + IMethodBinding mb = method.resolveMethodBinding(); |
| 403 | + boolean isSynthetic = mb != null && mb.isSynthetic(); |
| 404 | + var res = new MethodReferenceMatch(enclosing, accuracy, method.getName().getStartPosition(), |
| 405 | + method.getStartPosition() + method.getLength() - method.getName().getStartPosition(), false, |
| 406 | + isSynthetic, (accuracy & PatternLocator.SUPER_INVOCATION_FLAVOR) != 0, insideDocComment(node), getParticipant(locator), resource); |
| 407 | + res.setRaw(mb != null && mb.isRawMethod()); |
| 408 | + res.setLocalElement(DOMASTNodeUtils.getLocalJavaElement(node)); |
| 409 | + return res; |
| 410 | + } |
375 | 411 | if (node.getLocationInParent() == SingleMemberAnnotation.VALUE_PROPERTY && locator.pattern instanceof MethodPattern) { |
376 | 412 | var res = new MethodReferenceMatch(DOMASTNodeUtils.getEnclosingJavaElement(node), accuracy, |
377 | 413 | node.getStartPosition(), node.getLength(), true, |
|
0 commit comments