This specification is not final and is subject to change. Use is subject to license terms.

Documentation Comment Specification for the Standard Doclet (JDK 19)

This document specifies the form of documentation comments recognized by the standard doclet for the javadoc tool in JDK 19, used to generate HTML documentation for an API.

In the context of the javadoc tool, the interpretation of the content of a documentation comment is up to doclet that is used to process the comment. Other doclets may accept the same syntax as the standard doclet, or they may support an alternate syntax. However, due to support in many tools, the syntax supported by the standard doclet has become a de facto standard.

General Syntax

Documentation comments are recognized only when placed immediately before module, package, class, interface, constructor, method, or field declarations. Documentation comments placed in the body of a method are ignored. Only one documentation comment per declaration statement is recognized.

For historical reasons, the documentation comment for a package may instead be provided in a file called package.html in a source directory for the package. In this case, the documentation comment is the content of the <body> tag, and all references to Java types (for example, in @see tags) must be fully qualified. The standard doclet also allows additional documentation to be provided in files such as overview.html. The rules for such content are the same as for package.html.

The overall form of a documentation comment is an initial (main) description, followed by a series of block tags that provide additional information about the declaration to which the comment applies. The first sentence of the initial description should be a summary sentence that contains a concise but complete description of the declared entity. Descriptive text may include HTML tags and entities, and inline tags as described below.

It is possible to have a comment with only a tag section and no initial description. The description cannot continue after the tag section begins. The argument to a tag can span multiple lines. There can be any number of tags; some types of tags can be repeated while others cannot.

Leading Asterisks

When a documentation comment is read, leading asterisks (*) on each line are discarded, and blanks and tabs that precede the initial asterisks (*) are also discarded. If you omit the leading asterisk on a line, then the leading white space is no longer removed so that you can paste code examples directly into a documentation comment inside a <pre> tag with its indentation preserved. Spaces are interpreted by browsers more uniformly than tabs. Indentation is relative to the left margin (rather than the separator /** or <pre> tag).

HTML Content

HTML content is not formally checked, although some tools may provide some amount of checking to help catch common errors.

In order to be able to generate documentation that conforms to the appropriate standards, the following considerations should be taken into account when using HTML constructs in a documentation comment:

Comment Inheritance

Class and Interface Inheritance

Comment inheritance occurs in all possible cases of inheritance from classes and interfaces:

In the first two cases, the standard doclet generates the subheading "Overrides" in the documentation for the overriding method. A link to the method being overridden is included, whether or not the comment is inherited.

In the third case, when a method in a specified class implements a method in an interface, the standard doclet generates the subheading "Specified by" in the documentation for the overriding method. A link to the method being implemented is included, whether or not the comment is inherited.

Method Comment Inheritance

The standard doclet allows method comment inheritance in classes and interfaces to fill in missing text or to explicitly inherit method comments. Constructors, fields, and nested classes do not inherit documentation comments.

Note: The source file for an inherited method must be on the path specified by the -sourcepath option for the documentation comment to be available to copy. Neither the class nor its package needs to be passed in on the command line.

Fill in Missing Text

When a main description, or @return, @param, or @throws tag is missing from a method comment, the information is copied from the method it overrides or implements (if any).

When an @param tag for a particular parameter is missing, the comment for that parameter is copied from the method further up the inheritance hierarchy. When an @throws tag for a particular exception is missing, the @throws tag is copied only when that exception is declared.

Explicit Inheritance

Insert the {@inheritDoc} inline tag in a method main description or @return, @param, or @throws tag comment. The corresponding inherited main description or tag comment is copied into that spot.

Method Comments Algorithm

If a method does not have a documentation comment, or has an {@inheritDoc} tag, then the standard doclet uses the following algorithm to search for an applicable comment. The algorithm is designed to find the most specific applicable documentation comment, and to give preference to interfaces over superclasses:

  1. Look in each directly implemented (or extended) interface in the order they appear following the word implements (or extends) in the type declaration. Use the first documentation comment found for this method.
  2. If Step 1 failed to find a documentation comment, then recursively apply this entire algorithm to each directly implemented (or extended) interface in the same order they were examined in Step 1.
  3. When Step 2 fails to find a documentation comment and this is a class other than the Object class, but not an interface:
    1. If the superclass has a documentation comment for this method, then use it.
    2. If Step 3a failed to find a documentation comment, then recursively apply this entire algorithm to the superclass.

Block Tags

A block tag must appear at the beginning of a line, ignoring leading asterisks, white space, and the initial comment delimiter (/**). This means you can use the @ character elsewhere in the text and it will not be interpreted as the start of a tag. If you want to start a line with the @ character and not have it be interpreted, then use the HTML entity &#064;. Each block tag has associated text, which includes any text following the tag up to, but not including, either the next block tag, or the end of the documentation comment. This associated text can span multiple lines.

Inline Tags

Inline tags are enclosed within braces ({ }) and may generally appear wherever descriptive text and HTML is permitted.

Some inline tags may contain free-form text. When such text explicitly contains braces, the braces must be "balanced", implying an equal number of appropriately nested left brace and right brace characters, so that the closing brace of the inline tag can be determined. No other lexical analysis of the text is performed; in particular, there is no special consideration of characters like ', ", and \.

When the text content is HTML, it may be possible to use entities &lbrace; and &rbrace; to represent unbalanced braces.

Standard Tags

The following sections describe the standard block and inline tags supported by the standard doclet.

Note: The standard doclet also supports user-defined tags conforming to the same general syntactic rules.

@author

Adds an "Author" entry with the specified name text to the generated documents when the -author option is used. A documentation comment can contain multiple @author tags. You can specify one name per @author tag or multiple names per tag. In the former case, the standard doclet inserts a comma (,) and a space between names. In the latter case, the entire text is copied to the generated document without being parsed. Therefore, you can use multiple names per line if you want a localized name separator other than a comma.

Introduced in JDK 1.0.

{@code}

Equivalent to <code>{@literal text }</code>.

Displays text in code font without interpreting the text as HTML markup or nested Javadoc tags. This enables you to use regular angle brackets (< and >) instead of the HTML entities (&lt; and &gt;) in documentation comments, such as in parameter types (<Object>), inequalities (3 < 4), or arrows (->). For example, the documentation comment text {@code A<B>C} displayed in the generated HTML page unchanged as A<B>C. This means that the <B> is not interpreted as bold and is in code font. If you want the same functionality without the code font, then use the {@literal} tag.

Introduced in JDK 1.5.

@deprecated

This tag is used in conjunction with the @Deprecated annotation to indicate that this API should no longer be used (even though it may continue to work). The standard doclet moves deprecated text ahead of the main description, placing it in italics and preceding it with a bold warning.

The first sentence of deprecated text should tell the user when the API was deprecated and what to use as a replacement. The standard doclet copies the first sentence to the summary section and index. Subsequent sentences can also explain why it was deprecated. You should include an {@link} tag that points to the replacement API.

Introduced in JDK 1.0.

{@docRoot}

Represents the relative path to the generated document's (destination) root directory from any generated page. This tag is useful when you want to include a file, such as a copyright page or company logo, that you want to reference from all generated pages. Linking to the copyright page from the bottom of each page is common.

This {@docRoot} tag can be used both on the command line and in a documentation comment. This tag is valid in all documentation comments: overview, module, package, class, interface, constructor, method and field, including the text portion of any tag (such as the @return, @param and @deprecated tags).

For example, on the command line, where the header, footer, or bottom are defined:

javadoc -bottom '<a href="{@docRoot}/copyright.html">Copyright</a>'.

When you use the {@docRoot} tag this way in a make file, some makefile programs require a special way to escape for the brace {} characters. For example, the Inprise MAKE version 5.2 running on Windows requires double braces: {{@docRoot}}. It also requires double (rather than single) quotation marks to enclose arguments to options such as the -bottom option (with the quotation marks around the href argument omitted).

For example, in a documentation comment:

/**
 * See the <a href="{@docRoot}/copyright.html">Copyright</a>.
 */

This tag is needed because the generated documents are in hierarchical directories, as deep as the number of subpackages. The expression <a href="{@docRoot}/copyright.html"> resolves to <a href="../../copyright.html"> for java/lang/Object.java and <a href="../../../copyright.html"> for java/lang/ref/Reference.java.

Introduced in JDK 1.3.

@exception

This tag is equivalent to the @throws tag, which is now the recommended form.

Introduced in JDK 1.0.

@hidden

Hides a program element from the generated API documentation. This tag may be used when it is not otherwise possible to design the API in a way that such items do not appear at all.

Introduced in JDK 9.

{@index}

Declares that a word or phrase, together with an optional short description, should appear in the index files generated by the standard doclet. The index entry will be linked to the word or phrase that will appear at this point in the generated documentation. The description may be used when the word or phrase to be indexed is not clear by itself, such as for an acronym.

Introduced in JDK 9.

{@inheritDoc}

Inherits (copies) documentation from the nearest inheritable class or implementable interface into the current documentation comment at this tag's location. This enables you to write more general comments higher up the inheritance tree and to write around the copied text.

This tag is valid only in these places in a documentation comment:

See Method Comment Inheritance for a description of how comments are found in the inheritance hierarchy. Note that if this tag is missing, then the comment is or is not automatically inherited according to rules described in that section.

Introduced in JDK 1.4.

Inserts an inline link with a visible text label that points to the documentation for the specified module, package, class, or member name of a referenced class. This tag is valid in all documentation comments: overview, module, package, class, interface, constructor, method and field, including the text portion of any tag, such as the @return, @param and @deprecated tags.

This tag is similar to the @see tag. Both tags require the same references and accept the same syntax for module/package.class#member and label. The main difference is that the {@link} tag generates an inline link rather than placing the link in the "See Also" section. The {@link} tag begins and ends with braces to separate it from the rest of the inline text. If you need to use the right brace (}) inside the label, then use the HTML entity notation &#125;.

There is no limit to the number of {@link} tags allowed in a sentence.

For example, here is a comment that refers to the getComponentAt(int, int) method:

Use the {@link #getComponentAt(int, int) getComponentAt} method.

From this code, the standard doclet generates the following HTML (assuming it refers to another class in the same package):

Use the <a href="Component.html#getComponentAt(int,int)">getComponentAt</a> method.

The previous line appears on the web page as:

Use the getComponentAt method.

Introduced in JDK 1.2.

{@linkplain}

Behaves the same as the {@link} tag, except the link label is displayed in plain text rather than code font. Useful when the label is plain text. For example, Refer to {@linkplain add() the overridden method}. displays as: Refer to the overridden method.

Introduced in JDK 1.4.

{@literal}

Displays text without interpreting the text as HTML markup or nested Javadoc tags. This enables you to use angle brackets (< and >) instead of the HTML entities (&lt; and &gt;) in documentation comments, such as in parameter types (<Object>), inequalities (3 < 4), or arrows (->). For example, the documentation comment text {@literal A<B>C} displays unchanged in the generated HTML page in your browser, as A<B>C. The <B> is not interpreted as bold (and it is not in code font). If you want the same functionality with the text in code font, then use the {@code} tag.

Introduced in JDK 1.5.

@param

Adds a parameter with the specified parameter name followed by the specified description to the "Parameters" section. The description may continue onto multiple lines. This tag is valid only in a documentation comment for a method, constructor, or class. The parameter name can be the name of a parameter in a method or constructor, or the name of a type parameter of a class, method, or constructor. Use angle brackets (< >) around such a parameter name to indicate the use of a type parameter.

Example of a type parameter of a class:

/**
 * @param <E> Type of element stored in a list
 */
public interface List<E> extends Collection<E> { ... }

Example of parameters, including type parameters, of a method:

/**
 * @param string  the string to be converted
 * @param type    the type to convert the string to
 * @param <T>     the type of the element
 * @param <V>     the value of the element
 */
<T, V extends T> V convert(String string, Class<T> type) { ... }

Introduced in JDK 1.0.

@provides

This tag may only appear in the documentation comment for a module declaration, and serves to document an implementation of a service provided by the module. The description may be used to specify how to obtain an instance of this service provider, and any important characteristics of the provider.

Introduced in JDK 9.

@return

As a block tag, adds a "Returns" section with the description text. This text should describe the return type and permissible range of values.

As an inline tag, provides content for the first sentence of a method's description, and a "Returns" section, as if @return description were also present. In the default English locale, the first sentence is Returns description .

This tag is valid only in a documentation comment for a method. As an inline tag, it may only occur at the beginning of a method's description.

Introduced as a block tag in JDK 1.0, and as an inline tag in JDK 16.

@see

Adds a "See Also" heading with a link or text entry that points to a reference. A documentation comment can contain any number of @see tags, which are all grouped under the same heading. The @see tag has three variations. The form to reference other program elements is the most common. This tag is valid in all documentation comments. For inserting an inline link within a sentence to a package, class, or member, see {@link}.

Adds a text entry for string. No link is generated. The string may be a reference to information which is not available by URL. The standard doclet distinguishes this from the other cases by searching for a double quotation mark (") as the first character.

Adds a link as defined by the url. The URL may be a relative or absolute URL. The standard doclet distinguishes this from other cases by searching for a less-than symbol (<) as the first character.

Adds a link with a visible text label that points to the documentation for the specified name that is referenced. The label is optional; if it is omitted, then the program element name appears instead as visible text, suitably shortened. Use the -noqualifier option to globally remove the package name from this visible text. Use the label when you want the visible text to be different from the auto-generated visible text.

module/package.class#member is any valid program element name that is referenced, such as a module, package, class, interface, constructor, method or field name. Parts of the name can be omitted as appropriate. The class represents any top-level or nested class or interface. The member represents any constructor, method, or field (not a nested class or interface). Parameterized types may be used in the class and member parts of the name. If this name is in the documented classes, then the standard doclet creates a link to it. A trailing / can be added to a name to refer to a module in the presence of a package or class with the same name.

To create links to external referenced classes, use the -link option. External referenced classes are classes that are not passed into the javadoc tool on the command line. Links in the generated documentation to external referenced classes are called external references or external links. For example, if you run the standard doclet on only the java.awt package, then any class in java.lang, such as Object, is an external referenced class. Use the -link and -linkoffline options to link to external referenced classes. The source comments of external referenced classes are not available to the javadoc command run.

Use either of the other two @see tag forms to refer to the documentation of a name that does not belong to a referenced class.

label is optional text that is visible as the link label. The label can contain white space. If label is omitted, then package.class.member appears, suitably shortened relative to the current class and package.

Introduced in JDK 1.0.

@serial

Used in the documentation comment for a default serializable field. See Documenting Serializable Fields and Data for a Class.

See also Oracle's Criteria for Including Classes in the Serialized Form Specification.

An optional field description should explain the meaning of the field and list the acceptable values. When needed, the description can span multiple lines. The standard doclet adds this information to the serialized form page.

If a serializable field was added to a class after the class was made serializable, then a statement should be added to its main description to identify at which version it was added.

The include and exclude arguments identify whether a class or package should be included or excluded from the serialized form page. They work as follows:

For example, the javax.swing package is marked with the @serial exclude tag in package-info.java. The public class java.security.BasicPermission is marked with the @serial exclude tag. The package-private class java.util.PropertyPermissionCollection is marked with the @serial include tag.

The @serial tag at the class level overrides the @serial tag at the package level.

Introduced in JDK 1.2.

@serialData

Uses the data description value to document the types and order of data in the serialized form. This data includes the optional data written by the writeObject method and all data (including base classes) written by the Externalizable.writeExternal method.

The @serialData tag can be used in the documentation comment for the readObject, writeObject, readExternal, writeExternal, readResolve, and writeReplace methods.

Introduced in JDK 1.2.

@serialField

Documents an ObjectStreamField component of the serialPersistentFields member of a Serializable class. Use one @serialField tag for each ObjectStreamField component.

Introduced in JDK 1.2.

@since

Adds a "Since" heading with the specified since-text value to the generated documentation. The text has no special internal structure. This tag is valid in any documentation comment: overview, module, package, class, interface, constructor, method, or field. This tag means that this change or feature has existed since the software release specified by the since-text value, for example: @since 1.5.

For Java platform source code, the @since tag indicates the version of the Java platform API specification, which is not necessarily when the source code was added to the reference implementation. Multiple @since tags are allowed and are treated like multiple @author tags. You could use multiple tags when the program element is used by more than one API.

Introduced in JDK 1.1.

@snippet

Includes a fragment, or "snippet", of example code in the generated documentation. The code may be provided inline within the tag by specifying a body and/or in an external file, specified in the attributes. Within the content, markup tags can be placed in line comments to identify regions within the text and instruct how to present the text in these regions.

Additional details about the snippet can be given as attributes, in the form of name=value pairs, placed after the initial tag name. An attribute name is always a simple identifier. An attribute value may be an identifier, unsigned integer, or enclosed in either single or double quote characters; no escape characters are supported. An attribute value and the preceding = may be omitted when the presence of the attribute name is sufficient. Attributes are separated from the tag name and from each other by whitespace characters, such as space and newline.

A snippet may specify an id attribute, which can be used to identify the snippet in both the API and the generated HTML, and which may be used to create a link to the snippet. In the generated HTML, the id will be placed on the outermost element that is generated to represent the snippet.

Code fragments are typically Java source code, but they may also be fragments of properties files, source code in other languages, or plain text. A snippet may specify a lang attribute, which identifies the kind of content in the snippet. For an inline snippet, the default value is java. For an external snippet, the default value is derived from the extension of the name of the file containing the snippet's content.

Inline snippets

An inline snippet contains the content of the snippet within the tag itself.

The content of the snippet, which is included in the generated documentation, is the text between the first newline after the colon (:) and the closing curly brace (}).

There is no need to escape characters such as <, >, and & with HTML entities, nor is there any need to escape documentation comment tags.

Surrounding whitespace is stripped from the content using String::stripIndent.

There are two limitations on the content of inline snippets:

  1. The character sequence */ cannot be used anywhere within the content, because the */ would terminate the enclosing documentation comment. This includes use of /* ... */ comments, or within a // comment, or within string literals, such as those used to represent regular expressions. This restriction applies to all content in documentation comments; it is not specific to the @snippet tag.

  2. The content of an inline snippet can only contain balanced pairs of curly-brace characters. The overall inline tag is terminated by the first right brace that matches the opening brace. This restriction applies to all inline tags; it is not specific to the @snippet tag.

External snippets

An external snippet refers to a separate class or file that contains the content of the snippet.

In an external snippet the colon, newline, and subsequent content can be omitted.

Unlike inline snippets, external snippets have no limitations on their content. In particular, they may contain /* ... */ comments.

The location of the external code can be specified either by class name, using the class attribute, or by a short relative file path, using the file attribute. In either case the file can be placed in a package hierarchy rooted in a snippet-files subdirectory of the directory containing the source code with the {@snippet ...} tag. Alternatively, the file can be placed on an auxiliary search path, specified by the --snippet-path option to the javadoc tool. The use of snippet-files subdirectories is similar to the use of doc-files subdirectories for auxiliary documentation files.

The file for an external snippet may contain multiple regions, to be referenced in different snippet tags, appearing in different parts of the documentation.

Hybrid snippets

A hybrid snippet is both an internal snippet and an external snippet. It contains the content of the snippet within the tag itself, for the convenience of anyone reading the source code for the class being documented, and it also refers to a separate file that contains the content of the snippet.

It is an error if the result of processing a hybrid snippet as an inline snippet does not match the result of processing it as an external snippet.

Markup tags

Markup tags define regions within the content of a snippet. They also control the presentation of the content, for example highlighting parts of the text, modifying the text, or linking to elsewhere in the documentation. They can be used in internal, external, and hybrid snippets.

Markup tags begin with @name, followed by any required arguments. They are placed in // comments (or the equivalent in other languages or formats), so as not to unduly interfere with the body of the source code, and also because /* ... */ comments cannot be used in inline snippets. Such comments are referred to as markup comments.

Multiple markup tags can be placed in the same markup comment. The markup tags apply to the source line containing the comment unless the comment is terminated with a colon (:), in which case it is as if the tags were present on the immediately following line. The latter syntax may be useful if the markup comment is particularly long, or if the syntactic format of the content of a snippet does not permit comments to appear on the same line as non-comment source. Markup comments do not appear in the generated output.

Because some other systems use meta-comments similar to markup comments, comments that begin with @ followed by an unrecognized name are ignored as markup comments and will appear in the generated output. If the name is recognized, but there are subsequent errors in the markup comment, then an error is reported. The generated output in such cases is undefined, with respect to the output generated from the snippet.

Regions

A region is an optionally-named range of lines that identifies the text to be displayed by a snippet. They also define the scope of actions such as highlighting or modifying the text.

The beginning of a region is marked by either

The end of a region is marked by @end or @end region=name. If a name is given then the tag ends the region started with that name. If no name is given then the tag ends the most recently started region that does not already have a matching @end tag.

There are no constraints on the regions created by different pairs of matching @start and @end tags. Regions can even overlap, although we do not expect such usage to be common.

Highlighting

To highlight content on a line or in a range of lines, use @highlight followed by arguments that specify the scope of the text to be considered, the text within that scope to be highlighted, and the type of the highlighting.

If region or region=name is specified then the scope is that region, up to the corresponding @end tag. Otherwise, the scope is just the current line.

To highlight each instance of a literal string within the scope, specify the string with substring=string where string can be an identifier or text enclosed in single or double quotes. To highlight each instance of text matched by a regular expression within the scope, use regex=string. If neither of these attributes are specified then the entire scope is highlighted.

The type of highlighting can be specified with the type parameter. Valid type names are bold, italic, and highlighted. The name of the type is converted to a CSS class name whose properties can be defined in the system stylesheet or overridden in a user-defined stylesheet.

Modifying the displayed text

It is often convenient to write the content of a snippet as code that can be accessed and validated by external tools, but to display it in a form that does not compile. For example, it may be desirable to include import statements for illustrative purposes along with code that uses the imported types. Or, it may be desirable to display code with an ellipsis or some other marker to indicate that additional code should be inserted at that point. This can be done by replacing parts of the content of the snippet with some replacement text.

To replace some text with replacement text, use @replace followed by arguments that specify the scope of the text to be considered, the text within that scope to be replaced, and the replacement text.

If region or region=name is specified then the scope is that region, up to the corresponding @end tag. Otherwise, the scope is just the current line.

To replace each instance of a literal string within the scope, specify the string with substring=string where string can be an identifier or text enclosed in single or double quotes. To replace each instance of text matched by a regular expression within the scope, use regex=string. If neither of these attributes are specified then the entire scope is replaced.

Specify the replacement text with the replacement parameter. If a regular expression is used to specify the text to be replaced then $number or $name can be used to substitute groups found in the regular expression, as defined by String::replaceAll.

To delete text, use @replace with an empty replacement string. To insert text, use @replace to replace some no-op text placed where the replacement text should be inserted. The no-op text might be a '//' marker, or an empty statement (;).

Linking text

To link text to declarations elsewhere in the API, use @link followed by arguments that specify the scope of the text to be considered, the text within that scope to be linked, and the target of the link.

If region or region=name is specified then the scope is that region, up to the corresponding @end tag. Otherwise, the scope is just the current line.

To link each instance of a literal string within the scope, specify the string with substring=string where string can be an identifier or text enclosed in single or double quotes. To link each instance of text matched by a regular expression within the scope, use regex=string. If neither of these attributes are specified then the entire scope is linked.

Specify the target with the target parameter. The form of its value is the same as used by the standard inline {@link ...} tag.


Introduced in JDK 18.

{@summary}

Identify the summary of an API description, as an alternative to the default policy to identify and use the first sentence of the API description. The tag only has significance when used at the beginning of a description. In all cases, the tag is rendered by simply rendering its content.

Introduced in JDK 10.

{@systemProperty}

Identify property-name as the name of a system property. The name should be a "dotted identifier". In particular, it must not contain white space characters, or characters such as }. No other content is permitted in the tag; the possibility of additional content is reserved for future use. The tag can be used in the documentation comments for modules, packages, types, fields and executable members.

Introduced in JDK 12.

@throws

Behaves the same as the @exception tag.

The @throws tag adds a "Throws" subheading to the generated documentation, with the class-name and description text. The class name is the name of the exception that might be thrown by the method. This tag is valid only in the documentation comment for a method or constructor. If the class name is not fully qualified, then the standard doclet uses the search order to look up this class. Multiple @throws tags can be used in a specified documentation comment for the same or different exceptions.

To ensure that all checked exceptions are documented, when an @throws tag does not exist for an exception in the throws clause, the standard doclet adds that exception to the generated output (with no description) as though it were documented with the @throws tag.

The @throws documentation is copied from an overridden method to a subclass only when the exception is explicitly declared in the overridden method. The same is true for copying from an interface method to an implementing method. You can use the {@inheritDoc} tag to force the @throws tag to inherit documentation.

Introduced in JDK 1.2.

@uses

This tag may only appear in the documentation comment for a module declaration, and serves to document that a service may be used by the module. The description may be used to specify the characteristics of the service that may be required, and what the module will do if no provider for the service is available.

Introduced in JDK 9.

{@value}

Displays constant values. When the {@value} tag is used without an argument in the documentation comment of a static field, it displays the value of that constant:

/**
 * The value of this constant is {@value}.
 */
public static final String SCRIPT_START = "<script>"

When used with the argument package.class#field in any documentation comment, the {@value} tag displays the value of the specified constant:

/**
 * Evaluates the script starting with {@value #SCRIPT_START}.
 */
public String evalScript(String script) {}

The argument package.class#field takes a form similar to that of the @see tag argument, except that the member must be a static field.

Introduced in JDK 1.4.

@version

Adds a "Version" subheading with the specified version-text value to the generated documents when the -version option is used. This tag is intended to hold the current release number of the software that this code is part of, as opposed to the @since tag, which holds the release number where this code was introduced. The version-text value has no special internal structure.

A documentation comment can contain multiple @version tags. When it makes sense, you can specify one release number per @version tag or multiple release numbers per tag. In the former case, the standard doclet inserts a comma (,) and a space between the names. In the latter case, the entire text is copied to the generated document without being parsed. Therefore, you can use multiple names per line when you want a localized separator other than a comma.

Introduced in JDK 1.0.

Where Tags Can Be Used

The following table summarizes which tags can be used in which contexts.

Contexts in which tags may be used
Tag Overview Module Package Type Constructor Method Field
@author
{@code}
@deprecated
{@docRoot}
@exception
@hidden
{@index}
{@inheritDoc}
{@link}
{@linkplain}
{@literal}
@param
@provides
@return
@see
@serial
@serialData *
@serialField *
@since
{@snippet}
{@summary}
{@systemProperty}
@throws
@uses
{@value}
@version

Notes: