Wednesday, April 20, 2011

Eclipse: Removing Todo: Auto-Generated comments

When you use Eclipse menus to create new class, constructor, method or even add a try/catch, typically it not only generates the functionality but also adds a TODO. This is good to indicate that the comment has to be replaced with a proper functionality.

However in a team environment, it's not easy to make people delete the line and add the code. Task remains and it becomes difficult to delete it at the end.

To remove the auto addition of that comment line, you have to follow the below steps:
Goto Window -> Preferences -> Java -> Code Style -> Code Templates
Click on Method Body.
Click Edit.
Remove the commented line. (Something like: // ${todo} Auto-generated method stub)
Click Apply.
Repeat the steps for other elements.

Click save.