Saturday, June 14, 2008

Netbeans 6.1 Javadoc Auto Comments

At the Greenville Java Users Group (GreenJUG) meeting the other night, the topic of auto comments for Javadocs was brought up. In Netbeans 6.1, if you enter a method and then starting typing /** / on the method it will create Javadoc comments for you. For example,

private String fx(String x) {
return x;

Next add a Javadoc comment /** */ and you will end up with something like this:

* @param x
* @return
private String fx(String x) {
return x;

This is a great start to your comments.

There is a plugin in the Netbeans Development Center called Javadoc Analyzer. Download and install this plugin. It will provide you with some cool additional functionality.

In this screenshot I have created a servlet using the Netbean defaults which include some default Javadoc comments. I then ran the Analyze Javadoc menu item under Source. You can see it found a number missing tags including some on the visible text.

I then instructed it to Fix Selected

This resulted in the comments being added and marked as completed.


Popular Posts