Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to auto generate ALL Javadoc comments in Eclipse?

I know that you can press shift+alt+j to insert an appropriate comment template for the current code block, but is there any way to let eclipse just go crazy and do a whole project like this?

like image 990
Finbarr Avatar asked Mar 27 '10 16:03

Finbarr


People also ask

How do I export Javadoc from Eclipse?

Step 1 − Open eclipse, select the option Project →Generate Javadoc. Step 2 − Select the javadoc.exe file from the bin folder of java installation directory, select the destination folder for the generated java doc and select Next. finish button.


1 Answers

For a whole project, may be not, but you can at least:

  • go to the Package Explorer View
  • expand the class you want to generate comment on (open each method)
  • select all the opened elements in the class from that Package Explorer Tree
  • alt+shift+J and voilà: comments generated on the class, and every method

The only reason it is not practical for the all project is:

  • you need to open every class you want to generate comments on
  • once a first set of methods have been commented, you still need to repeat the process if you have written new methods.

That being said, another approach is described in the article "The Problem of Incomplete Javadocs" from March, 30th 2010, advocating for an extended Javadoc view.

The extended Javadoc View is essentially an aggregator of different information sources for a single code element like a class, method, field or parameter. It is designed as a replacement for the existing Eclipse Javadoc.

alt text

The interesting part comes with the other tabs in the view: Subclassing Directives and Subclassing Patterns.
These tabs contain mined information about how developers typically extended the selected code element.

  • Subclassing tab:

subclassing directives are generalizations of frequently made observations in example code like "Subclasses of Wizard always override its method addPages()" or "Reimplementors of Dialog.createContents() may call its super implementation".

http://code-recommenders.googlecode.com/svn/wiki/images/extdoc/tab-subclassing-directives-Wizard.png

http://code-recommenders.googlecode.com/svn/wiki/images/extdoc/tab-subclassing-directives-Wizard-addPages.png

  • Subclassing Patterns Tab

Subclassing patterns try to group observed extensions of a base class into typical extension patterns, i.e., they cluster subclasses by similarity to find patterns in data.

http://code-recommenders.googlecode.com/svn/wiki/images/extdoc/tab-subclassing-patterns-ViewerComparator.png

like image 200
VonC Avatar answered Sep 22 '22 03:09

VonC