Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How tell tell javadoc that my period doesn't end a sentence

Tags:

javadoc

javadoc uses the first "sentence" of a doc comment as a summary sentence. It assumes that a period followed by a space, tab, or line terminator ends the sentence. Suppose I want an abbreviation like "e.g." or "etc." in my summary; is there a way to tell javadoc not to treat it as the end of a sentence? I can replace the period with . but I'm wondering if there's a less ugly way.

like image 649
ajb Avatar asked Aug 16 '13 21:08

ajb


People also ask

How do you write a Javadoc style comment?

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.

How do you end a Javadoc comment?

Javadoc scans your source files looking for documentation comments, also known as “Javadoc comments”. They begin with /** (two stars) and end with */ (one star).

How do I add a note in Javadoc?

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. Generally if you open (xml-)tags you should close them somewhere.

Is Javadoc still used?

Fortunately, all modern versions of the JDK provide the Javadoc tool – for generating API documentation from comments present in the source code.


1 Answers

It's best to avoid periods in the first sentence. In How to Write Doc Comments for the Javadoc Tool it's suggested that you should replace the space character as a workaround:

 /**
 * This is a simulation of Prof. Knuth's MIX computer.
 */

 /**
  * This is a simulation of Prof.<!-- --> Knuth's MIX computer.
  */

Personally, I would just omit the dot if I couldn't avoid abbreviations altogether.

like image 83
kapex Avatar answered Sep 24 '22 15:09

kapex