Search code examples
refactoringmethodologyprocedure

What is the quickest way to determine what code will be affected by a refactoring?


I'm using Eclipse and Java, but the answer doesn't need to be specific to those. I'm sure platform specific answers will get plenty of upvotes if they're far quicker than non-platform specific ones.

Right now I'm using

    grep "classname" find . -regex .*\.java > uses_classname.txt

to find code that might be affected by a change to the class. If there are only a few lines returned by this, I can look at it manually as it is. Otherwise, I can grep again to find the specific methods I'm modifying. Is there a better way to do this?


Solution

  • [Just being a bit of a librarian here:]

    Finding references to a Java method/class:

    How can I find all the methods that call a given method in Java?

    How can I find references of a class in Eclipse?

    References to Java annotations:

    How to Check References of Annotated Methods

    Finding references to 'derived' methods in Eclipse:

    Eclipse Specific: Is it possible to find references of use of derived methods in a class?

    How to do it with VIM:

    Is it possible to find usage of java classes or methods in VIM?

    And with Emacs:

    How can I find the references of a class, method, variable in Emacs with Etags?

    Finding (the number of) references to a method in C#:

    How do you programmatically identify the number of references to a method with C#

    Nice to read: how to find methods that are not used in C#/.NET:

    Find unused code

    Is there a tool for finding unreferenced functions (dead, obsolete code) in a C# app?

    On refactoring of PHP code:

    Tools for PHP code refactoring

    Finding references in Smalltalk:

    Find references to string/symbol/method

    Finding references in (Apple) Xcode seems to be a popular question:

    Find method references in Xcode

    Xcode: view references for a variable?

    Finding all references of a variable or a method in Xcode4