Skip to content

Commit 328f415

Browse files
robstrykermickaelistria
authored andcommitted
Fix testIssue708_1
Signed-off-by: Rob Stryker <[email protected]>
1 parent 5a2b33f commit 328f415

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,18 @@ public LocatorResponse resolveLevel(org.eclipse.jdt.core.dom.ASTNode node, IBind
269269
}
270270
if (variableBinding.isField()) {
271271
boolean mightMatch = false;
272-
if( this.fieldLocator.pattern.findDeclarations && node instanceof VariableDeclarationFragment vdf && vdf.getParent() instanceof FieldDeclaration) {
272+
if( !mightMatch && this.fieldLocator.pattern.findDeclarations && node instanceof VariableDeclarationFragment vdf && vdf.getParent() instanceof FieldDeclaration) {
273273
mightMatch = true;
274274
}
275-
if(this.fieldLocator.pattern.readAccess && this.fieldLocator.pattern.writeAccess) {
275+
if( !mightMatch && this.fieldLocator.pattern.findDeclarations && node instanceof EnumConstantDeclaration ecd && ecd.getParent() instanceof EnumDeclaration) {
276276
mightMatch = true;
277-
} else {
277+
}
278+
279+
if(!mightMatch && this.fieldLocator.pattern.readAccess && this.fieldLocator.pattern.writeAccess) {
280+
mightMatch = true;
281+
}
282+
283+
if(!mightMatch) {
278284
ASTNode working = node instanceof Name n && n.getParent() instanceof QualifiedName qn ? qn : node;
279285
boolean isQualified = working == node ? false : true;
280286
boolean qualifierRead = working instanceof QualifiedName qn ? qn.getQualifier() == node : false;
@@ -317,6 +323,8 @@ public LocatorResponse resolveLevel(org.eclipse.jdt.core.dom.ASTNode node, IBind
317323
mightMatch |= working.getParent() instanceof FieldAccess;
318324
}
319325
}
326+
327+
320328
if( mightMatch ) {
321329
return toResponse(this.matchField(variableBinding, true));
322330
}

0 commit comments

Comments
 (0)