Skip to content
StefanMedeleanu edited this page Jun 30, 2016 · 1 revision

The plugin can be loaded in Eclipse by selecting it from Window -> Show View -> Other -> Code improvement -> Null Terminator Once loaded you will have 2 empty tables and a console area where useful information will be printed. There are four buttons that mean the following:

- Load the selected project under the project/package explorer

- Load the project corresponding to the active file opened in editor

- Unload the loaded project. Is recommended to unload then load again the project between refactorings in order for the plugin load the updated files.

- Clear the text area.

After loading a project, the null checked variables and methods will be show in the 'Null checked elements' table, order by name so all null checks related to the same variable are grouped. There are two possible actions that you can perform on this table:

  • double right clicking an element from the table, will open the corresponding null check in the editor
  • left clicking an element will open a small menu where you can select to refactor the code and apply the Null Object pattern, or you can find all the relevant null assignments for this element. It is recommended to perform the null finding first in order to be sure that all relevant null assignments can be replaced (not coming from external .jar for example). All the null assignments found are shown in the 'Null assignments found' table. Those marked with (*) are coming from collections or external .jar. In collection case is up to you to search the possible places where null may be added to that collection.

After making sure that all relevant null assignments can be replaced, you can perform the refactoring and then manually replace the relevant null assignments with an instance of the newly created null class.

Clone this wiki locally