Refactoring support

The goal of Java program refactoring is to make system-wide code changes without affecting the behavior of the program. The Java tools provide assistance in easily refactoring code.

The refactoring tools support a number of transformations described in Martin Fowler's book Refactoring: Improving the Design of Existing Code, Addison Wesley 1999, such as Extract Method, Inline Local Variable, etc.

When performing a refactoring operation, you can optionally preview all of the changes resulting from a refactoring action before you choose to carry them out. When previewing a refactoring operation, you will be notified of potential problems and will be presented with a list of the changes the refactoring action will perform. If you do not preview a refactoring operation, the change will be made in its entirety and any resultant problems will be shown. If a problem is detected that does not allow the refactoring to continue, the operation will be halted and a list of problems will be displayed.

Refactoring commands are available from the context menus of several Java views (e.g. Package Explorer, Outline) and editors. Many "apparently simple" commands, such as Move and Rename, are actually refactoring operations, since moving and renaming Java elements often require changes in dependent files.

Related concepts
Java development tools (JDT)

Related tasks
Refactoring
Refactoring without preview
Refactoring with preview
Previewing refactoring changes
Undoing a refactoring operation
Redoing a refactoring operation

Related reference
Refactoring actions
Refactoring wizard
Refactoring preferences
Extract Method Errors

Legal notices