A couple of days ago i blogged about the missing “Auto comment” feature on the new netbeans 6. Well today i updated my platform and voila i got the feature back in a kind of different way than the auto comment tool. This time it is how they prommised it would be, integrated with the editor.

When you write a method on an object and pause the cursor over the definition there is a “bulp” that comes up and notifies you that the javadoc is missing. You can click on it and then an auto complete dialog comes up. Here is how it looks:

(click) ↓

To enable this you have to go through the options of netbeans editor. Go to “Tools -> Options -> Java Code -> Hints”. There you will find how the editor notifies you about stuff that happen while you write (errors and other things). Notice the Javadoc checkbox. As you can see on the left you have to enable it and then two sub-options will show up. How your editor will notify you on non existent javadocs and how it will notify you on error on the javadocs. You have to specify the scope of the docs to create. This means that if you want to create javadocs only for public methods specify this here and no notification will pop-up on any other method. In my case, as you can see, i have enabled “private” which means that i want to create javadocs for methods of any scope.

When you click on the create missing javadocs bubble a miracle will happen and javadocs will be automaticaly placed for that method. Not ony this but there will be a “@param” tag for each parameter, a “@returns” for the return and a “@throws” for each exception! Nifty huh?

I have to admit that the new way of commenting is much better since it requires far less clickies here and there. I would like to see the “Auto comment” tool as a plugin though just to be able to manage your docs in a more “friendly” way.