Skip to content

Commit 375c8c0

Browse files
committed
Do not match method name as field
1 parent eb7237f commit 375c8c0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

org.eclipse.jdt.core.javac/src/org/eclipse/jdt/internal/core/search/matching/DOMFieldLocator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.eclipse.jdt.core.dom.ITypeBinding;
2929
import org.eclipse.jdt.core.dom.IVariableBinding;
3030
import org.eclipse.jdt.core.dom.ImportDeclaration;
31+
import org.eclipse.jdt.core.dom.MethodInvocation;
3132
import org.eclipse.jdt.core.dom.Name;
3233
import org.eclipse.jdt.core.dom.QualifiedName;
3334
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
@@ -82,6 +83,9 @@ public LocatorResponse match(Name name, NodeSetWrapper nodeSet, MatchLocator loc
8283
if (name.getLocationInParent() == SingleVariableDeclaration.NAME_PROPERTY || name.getLocationInParent() == VariableDeclarationFragment.NAME_PROPERTY) {
8384
return toResponse(PatternLocator.IMPOSSIBLE_MATCH); // already caught by match(VariableDeclaration)
8485
}
86+
if (name.getLocationInParent() == MethodInvocation.NAME_PROPERTY) {
87+
return toResponse(IMPOSSIBLE_MATCH);
88+
}
8589

8690
if (this.fieldLocator.matchesName(this.fieldLocator.pattern.name, name.toString().toCharArray())) {
8791
if (this.fieldLocator.isDeclarationOfAccessedFieldsPattern

0 commit comments

Comments
 (0)