Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaDoc: private fields and methods

What JavaDoc tags should I use in private fields and methods in order to generate javaDoc descriptions?

like image 327
itun Avatar asked Apr 13 '11 21:04

itun


People also ask

Does Javadoc work with private methods?

Yes you should write JavaDoc for private methods, and even when it is only for yourself. In 3 years when you have to change the code, you will be happy that you documented it. If you leave the company, or have to work on another project, your co-workers will be happy to have a documented code.

Do protected methods need Javadoc?

All public and protected methods should be fully defined with Javadoc. Exception may be when a method is a simple getter or setter where a description would not add any information though it does no harm to do so. Package and private methods do not have to be documented, but may benefit from it.

Do you need to Javadoc overridden methods?

Javadoc is not required on a method that is tagged with the @Override annotation. However, under Java 5 it is not possible to mark a method required for an interface (this was corrected under Java 6). Hence, Checkstyle supports using the convention of using a single {@inheritDoc} tag instead of all the other tags.

How do I add a method to a Javadoc?

Place the caret at the declaration in the editor, press Alt+Enter , and select Add Javadoc from the list.


1 Answers

See Java Javadoc include Private; you still use the standard JavaDoc comment form but you must instruct the JavaDoc tool to generate the documentation for private members using the -private switch.

like image 127
no.good.at.coding Avatar answered Nov 15 '22 14:11

no.good.at.coding