Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are There Any Tools For Updating Javadoc Automatically?

Tags:

java

javadoc

I work on a code base that is ... messy. One aspect of this messiness is that we have a ton of methods whose signatures no longer match the associated Javadoc. For instance:

/**
 *
 * @ param foo
 */
public void doFoo(int bar) {...

I'm no fan of generated Javadoc (as it's almost always worthless), but I really could use a tool that would go through our code, find cases like that, and:

  1. remove the javadoc for the "foo" param
  2. add javadoc for the "bar" param (but just a blank one, no auto-generated doc or anything)

Does such a tool exist? If not, does a tool that just does #1 exist? Even that much would significantly reduce the amount of garbage warnings we get in our builds. Thanks.

like image 296
machineghost Avatar asked Dec 07 '09 19:12

machineghost


People also ask

How do I create an automatic Javadoc?

In the Package Explorer view, select a Java project and click Project > Generate Javadoc with Diagrams > Automatically. In the Generate Javadoc wizard, under Javadoc command, select the Javadoc command (an executable file).

What does @SEE do in Javadoc?

In short, we use the @see tag when we want a link or a text entry that points to a reference. This tag adds a “See Also” heading to the reference. A document comment can hold any number of @see tags, all of which can be grouped under the same heading.

Which tool is used to generate API documentation HTML format from doc comments in source code?

Javadoc is a tool for generating API documentation in HTML format from doc comments in source code.

Is Javadoc still used?

Javadoc is pretty much the accepted standard for documenting java code.


3 Answers

NetBeans has a tool for that. It does exactly what you ask.

You can either click on the Tools Menu, then Analyze Javadocs from the top, or right click on a file and click Tools, then Analyze Javadocs.

This then give you a list of all problems it finds with your Javadocs with an option to fix it. It allows you to fix a single problem in a method, fix the javadocs for the method, for the file, for the package, or for the entire project.

like image 85
Dan McGrath Avatar answered Oct 14 '22 05:10

Dan McGrath


One solution, if you're using eclipse, is to go to Window -> Preferences -> Java -> Compiler -> Javadoc and then set the 'Malformed Javadoc comments' variable to warning or error.

You can then go to the problems view Window -> Show View -> Problems and then on each error right click and select 'Quick Fix'.

like image 3
Jared Russell Avatar answered Oct 14 '22 06:10

Jared Russell


I have not tried any of these other than DocCheck, but this somewhat-dated page on Sun's site lists several third-party doclets, some of which purport to insert Javadoc into your source. Of those, you might take a look at Doc-o-Matic, JRefactory Pretty Printer, and ACTOS Auto Commentator for Java. Again, I have not tried any of these, but it's a place to start.

like image 2
shoover Avatar answered Oct 14 '22 07:10

shoover