Skip to content

Commit bec64f4

Browse files
committed
Fix testModuleImportPatternReferences
Signed-off-by: Rob Stryker <[email protected]>
1 parent aa21cee commit bec64f4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.eclipse.jdt.core.dom.Name;
2222
import org.eclipse.jdt.core.dom.OpensDirective;
2323
import org.eclipse.jdt.core.dom.RequiresDirective;
24+
import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor;
2425
import org.eclipse.jdt.internal.core.search.LocatorResponse;
2526

2627
public class DOMModuleLocator extends DOMPatternLocator {
@@ -44,16 +45,18 @@ public LocatorResponse match(ModuleDeclaration node, NodeSetWrapper nodeSet, Mat
4445
public LocatorResponse match(Name name, NodeSetWrapper nodeSet, MatchLocator locator) {
4546
if (pattern.findReferences
4647
&& isValidLocationForModuleNameReference(name)
47-
&& matchesName(name.toString().toCharArray(), pattern.name)) {
48+
&& matchesName(pattern.name, name.toString().toCharArray())) {
4849
return toResponse(POSSIBLE_MATCH);
4950
}
5051
return toResponse(IMPOSSIBLE_MATCH);
5152
}
5253

5354
private boolean isValidLocationForModuleNameReference(ASTNode name) {
54-
if (name.getLocationInParent() == RequiresDirective.NAME_PROPERTY
55-
|| name.getLocationInParent() == ExportsDirective.MODULES_PROPERTY
56-
|| name.getLocationInParent() == OpensDirective.MODULES_PROPERTY) {
55+
StructuralPropertyDescriptor loc = name.getLocationInParent();
56+
if (loc == RequiresDirective.NAME_PROPERTY
57+
|| loc == ExportsDirective.MODULES_PROPERTY
58+
|| loc == OpensDirective.MODULES_PROPERTY
59+
|| loc == ImportDeclaration.NAME_PROPERTY) {
5760
return true;
5861
}
5962
if (name.getAST().apiLevel() >= AST.JLS23 &&

0 commit comments

Comments
 (0)