After writing code for a while, it's a common practice to review what you've written. At that point, you may decide that you want to delete some of the code as it's no longer needed. Deleting code, however, can be dangerous, especially on larger projects, as you don't always know how many references you have to the code to delete and where they are.
Fortunately, NetBeans provides a Safely Delete refactor.
First we will need a Java project to perform some safe delete refactoring. We will use the same project from the earlier recipe, Rename refactoring, and so ensure that you have the project open from the end of that recipe. If you have not followed that recipe, the project is available from the code download bundle under the MoveRefactor
folder in Chapter 3
. When the Projects explorer shows the Refactoring
project, expand the Refactoring
node if not yet expanded.