Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JAVADOC for private methods (BlueJ)

I'm using BlueJ and I would like to generate the Javadoc of my whole project. I would like to show private methods on the Javadoc, is there any way to do it? BlueJ has a tool which makes the Javadoc, but BlueJ ignore private methods. Is just a convention? If it's a convention, I don't understand why, they ignore "internal" methods, they are useful too -.-*

like image 977
Thorba Avatar asked Jan 02 '12 00:01

Thorba


1 Answers

This link suggests that BlueJ will only generate JavaDocs for public methods and classes. Specifically:

your output will only contain information about public methods and variables

However, according to this bug report linked to in Andrew Thompson's answer, it appears this has been fixed in version 1.1.5 of BlueJ. In fact, according to section 9.8 of the BlueJ Reference Manual, you can specify exactly what options to use when running the JavaDoc tool by editing the doctool.options property.

There appear to be 3 properties that control the behaviour of documentation generation:

  • doctool.command: controls what command is used to generate documentation, and by default is set to javadoc
  • doctool.outputdir: controls where generated documentation is saved, and by default is set to doc
  • doctool.options: controls other command line options passed to the command specified by javadoc.command, and by default is set to -author –version –nodeprecated –package. Note, that by replacing -package with -private you can document all methods.

In general, since the JavaDoc tool is a command line program, you can simply call it yourself from the command line with something like this:

$ javadoc -d \path\to\output\folder -sourcepath \path\to\source\folder -private

Note, this command assumes that the javadoc is included in your PATH environment variable, which is usually the case in most java installations.

  • The -d option gives the desired output directory
  • The -sourcepath option tells the JavaDoc tool where to find the source code to document
  • The -private option tells the JavaDoc tool to create documentation for all classes, members, and methods (as private is the most restricted visibility)

The full list of options that control the members that JavaDoc will document is:

  • -public - Shows only public classes and members.
  • -protected - Shows only protected and public classes and members. This is the default.
  • -package - Shows only package, protected, and public classes and members.
  • -private - Shows all classes and members.

(Taken from the JavaDoc Documentation)

EDIT 0: Updated answer to incorporate new information brought to light by Andrew Thompson

like image 80
chrisbunney Avatar answered Sep 25 '22 13:09

chrisbunney