Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.5.1Release
-
Component/s: Refactoring
-
Labels:None
-
Number of attachments :
Description
- In Foo.groovy
class Foo { def foo }
- In Other.groovy
new Foo().foo
- 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.
OK. I have something that appears to be working now. However, I am not sure of something. It is possible that a private field in a Java class is legally accessed in a groovy class. I should probably expand the refactoring search scope for Java classes as well if they are in groovy projects. Originally, I did not want to change behavior for Java files, but I may have to.