Skip to content

Commit 2ceee49

Browse files
authored
Reset source to result group source when using search in push down (#2151)
- fix PushDownRefactoringProcessor.getReferencingElementsFromProject() method to reset the source string each time we look at a SearchResultGroup as the source may change from group to group and is not guaranteed to be the original compilation unit
1 parent ac95931 commit 2ceee49

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

org.eclipse.jdt.core.manipulation/refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/PushDownRefactoringProcessor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ private static IJavaElement[] getReferencingElementsFromProject(IMember member,
393393
String source= cu.getSource();
394394
CompilationUnit cuRoot= null;
395395
for (SearchResultGroup group : (SearchResultGroup[]) engine.getResults()) {
396+
source= group.getCompilationUnit().getSource();
396397
for (SearchMatch searchResult : group.getSearchResults()) {
397398
if (source.charAt(searchResult.getOffset() - 1) == '.') {
398399
if (cuRoot == null) {

0 commit comments

Comments
 (0)