Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaDoc: where to add notes/remarks to documentation?

When coding in C# I have always found the tag remarks very useful for providing notes about the implementation of a class or method, or to give information about the theory of what I was implementing. I am now using Java but I can't find an appropriate JavaDoc tag for this. Maybe in Java you accomplish this in a different manner, does anybody know?

like image 243
tunnuz Avatar asked Apr 11 '11 09:04

tunnuz


People also ask

Where do I put Javadoc comments?

Writing Javadoc Comments In general, Javadoc comments are any multi-line comments (" /** ... */ ") that are placed before class, field, or method declarations. They must begin with a slash and two stars, and they can include special tags to describe characteristics like method parameters or return values.

Do Javadoc comments go before or after annotations?

Also of interest here - the annotation is on the same line as the other qualifiers for the method. I've never seen that done before, but it seems to suggest that annotations should be treated much like other qualifiers for a method, and as such, the javadoc should definitely go before it.

How do I document a Javadoc?

From the main menu, select Tools | Generate JavaDoc. In the dialog that opens, select a scope — a set of files or directories for which you want to generate the reference, and set the output directory where the generated documentation will be placed.

How do you write a comment on a document?

Format of a Doc CommentA doc comment is written in HTML and must precede a class, field, constructor or method declaration. It is made up of two parts -- a description followed by block tags. In this example, the block tags are @param , @return , and @see .


2 Answers

With iteration 8 of the Java programming language, developers finally have been provided with three additional tags they can use in their code's documentation – and which should meet your needs: @apiNote, @implSpec and @implNote (cf., for instance, for a more detailed discussion: blog.codefx.org/java/new-javadoc-tags/).

like image 24
fbahr Avatar answered Sep 19 '22 16:09

fbahr


As far as I know, there isn't any dedicated Javadoc tag for notes or remarks. Generally, the first sentence of Javadoc should give a brief description of the class/method/field. Then the full description should follow. And if you want to include any notes, a specialized paragraph with a "Note:" prepended should suffice.

/**  * Brief description. Full description of the method, generally without  * implementation details.  * <p>  * Note: Additional information, e.g. your implementation notes or remarks.  * </p>  * @param input description of the parameter  * @return description of return value  *   * @since version  * @author name of the author  */ public boolean doSomething(String input) {     // your code } 
like image 130
janhink Avatar answered Sep 17 '22 16:09

janhink