GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-1054

Renaming private fields, methods, and all properties will not update references in non-working copies

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.1Release
    • Component/s: Refactoring
    • Labels:
      None
    • Number of attachments :
      0

      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:

      1. pattern.focus is a private field or method in a groovy compilation unit
      2. 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.

        Activity

          People

          • Assignee:
            Andrew Eisenberg
            Reporter:
            Andrew Eisenberg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: