- In Foo.groovy
- In Other.groovy
- Close and save Other.groovy
- Rename foo
Reference to foo in Other.groovy is not updated. This is because org.eclipse.jdt.internal.corext.refactoring.RefactoringScopeFactory.create(IJavaElement, boolean, boolean) ignores otehr compilation units if the target to rename if private (and in this case, foo is a property, so it is private).
Potential solution: in org.eclipse.jdt.core.search.SearchEngine.search(SearchPattern, SearchParticipant, IJavaSearchScope, SearchRequestor, IProgressMonitor), add a hook into language support that will check the search pattern and requestor to see of the search scope should be expanded.
Here are the criteria for expanding the search scope:
- pattern.focus is a private field or method in a groovy compilation unit
- requestor is of type (or a subtype of) org.eclipse.jdt.internal.corext.refactoring.CollectingSearchRequestor.
If this matches, then create a search scope that encompasses the entire project and all depending projects.
This solution is more than a little ugly, but I don't see any other way of proceeding.