While comments are certainly an important part of code documentation, and become much appreciated later on during maintenance and support phases of an application, they can be quite tedious to write, particularly in cases where you are documenting the obvious. In some situations you may be able to get away without writing comments for these types of methods, but in some situations your IDE or Javadoc report may still flag those methods as missing Javadoc comments and so it’s best to put them in anyway.

JAutodoc is a super Eclipse plugin for assisting you with writing comments. It comes with customizable method prefix mappings to comment phrases. For example, if your method begins with ‘add’ the phrase ‘Adds the’ will be placed in the comment. Thus, if the method name was ‘addEmployee’ the comment text would be ‘Adds the employee’. If the method were ‘isActive’, the method text becomes ‘Checks if is active’. All of the mappings are customizable from the plugin properties.

It can be set to use the Eclipse comment formatter, to replace the existing Javadoc or to complete it, as well as optionally add a todo annonation to it for future review. It fills out all the parameters passed and return parameters as well.

You can highlight an individual method and right click and choose JAutodoc from the menu, or select the entire source of the class and complete all the javadocs. It saves a lot of time getting the skeleton of your javadoc comments in place, allowing you to focus your commenting time and energy on writing meaningful descriptions where necessary.

To read more about the plugin and download it, see the JAutodoc web site.