From 727ca2024d3455913c7977726b67a1d29225c5f9 Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Mon, 4 Nov 2024 15:04:24 -0500 Subject: [PATCH] Resolve bindings during acceptAST call instead of after Signed-off-by: Rob Stryker --- .../internal/core/search/matching/MatchLocator.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) 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 fe4f08044d2..33b7891de3a 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 @@ -1392,10 +1392,6 @@ protected void locateMatchesWithASTParser(JavaProject javaProject, PossibleMatch } org.eclipse.jdt.core.ICompilationUnit[] nonNullUnits = Arrays.asList(unitArray).stream().filter(x -> x != null).toArray(org.eclipse.jdt.core.ICompilationUnit[]::new); -// debugMethodOne(javaProject, possibleMatches[0], new org.eclipse.jdt.core.ICompilationUnit[] {units[0]}); -// debugMethodTwo(javaProject, possibleMatches[0], new org.eclipse.jdt.core.ICompilationUnit[] {units[0]}); -// debugMethodThree(javaProject, possibleMatches[0], units); - if (nonNullUnits.length == 0) { return; } @@ -1430,6 +1426,7 @@ public void acceptAST(org.eclipse.jdt.core.ICompilationUnit source, org.eclipse. if( possibleMatches[i] == pm ) { domUnits[i] = ast; nonNullDomIndexes.add(i); + ast.accept(new PatternLocatorVisitor(MatchLocator.this.patternLocator, possibleMatches[i].nodeSet, MatchLocator.this)); return; } } @@ -1438,13 +1435,6 @@ public void acceptAST(org.eclipse.jdt.core.ICompilationUnit source, org.eclipse. // todo, use a subprogressmonitor or slice it }, this.progressMonitor); - - nonNullDomIndexes.forEach(x -> { - PossibleMatch possibleMatch = possibleMatches[x]; - org.eclipse.jdt.core.dom.CompilationUnit ast = domUnits[x]; - ast.accept(new PatternLocatorVisitor(this.patternLocator, possibleMatch.nodeSet, this)); - }); - for( int x : nonNullDomIndexes ) { PossibleMatch possibleMatch = possibleMatches[x]; this.currentPossibleMatch = possibleMatch;