The Methods menu of the Class Browser or Primitive Types Browser enables you to audit the local variables in the current method and display those that are unused.
To audit local variables in the method selected in the Methods List
Select the Unused Local Variables command from the Methods menu. The first unused local variable in the method is then highlighted and the Find Unused Variables dialog is displayed, asking if you want to search for the next unused local variable in the method.
Click the Yes button if you want to view the next unused local variable. Alternatively, click the No button if you want to remove the highlighted local variable from the method and then recompile the method (by pressing F8).
The dialog informs you when there are no more unused local variables in the current method. Click the OK button to return focus to your method. The Schema menu in the Schema Browser enables you to audit the local variables that are unused in all methods in a schema or class.
To audit local variables and parameters in all methods or a class of the schema selected in the Schema Browser
Select the Find Unused Local Variables/Parameters command from the Schema menu. The Find Unused Local Variables and Parameters dialog, shown in the following diagram, is then displayed.
If you do not want to search for unused local variables and parameters in all methods in all schemas (the default value), perform one of the following actions in the Search Criteria group box.
Select the Search selected schema option button and in the combo box below the option button, select the schema in which you want to locate unused local variables and parameters in all methods.
Select the Search selected schema and all sub-schemas option button and in the combo box above the option button, select the schema in which you want to locate unused local variables and parameters in all methods in that schema and its subschemas.
Select the Search selected class in selected schema option button and in the combo box below the option button, select the class of the schema selected in the first combo box or that has a local copy class whose methods will be scanned for unused local variables and parameters.
In the Reporting Options group box:
Uncheck the Local Variables check box if you do not want to display unused local variables. This check box is checked by default; that is, unused local variables are output to the report.
Uncheck the Method Parameters check box if you do not want to display unused method parameters. This check box is checked by default; that is, unused method parameters are output to the report.
If you want to display unused method parameters in all methods in the schema instead of all methods except for event methods (the default), select the All Methods option button. The Parameters group box is visible only when the Method Parameters check box is checked.
Click the Search button to initiate the search. Alternatively, click the Cancel button to abandon your selections.
The result of your search is output to a report that is displayed in print preview mode. This report contains the:
Schema of the method
Class in which the method is defined
Method name where the create was performed
Line number in the method of the unused variable statement or parameter
Variable name of the unused local variable or parameter
Type of value; that is, variable or parameter