RFR: JDK-8075778: Add javadoc tag to avoid duplication of return information in simple situations.

Jonathan Gibbons jjg at openjdk.java.net
Fri Nov 20 17:56:15 UTC 2020


This change extends the functionality of the `@return` tag so that it can also be used as an inline tag in the first sentence of a description.

The goal is to be able to simplify the following common pattern:

    /**
     * Returns the result. Optional additional text.
     * @return the result
     */
    int method() { 

by 

    /**
     * {@return the result} Optional additional text.
     */
    int method() { 

Note:

* The inline tag may only be used at the beginning of the description. A warning will be given if it is used elsewhere.
* The expansion of the inline tag is `Returns " _content_ `.`  where _content_ is the content of the tag. 
* If there is no block `@return` tag, the standard doclet will look for an inline tag at the beginning of the description
* The inline tag can be inherited into overriding methods as if it was provided as a block tag.

-------------

Commit messages:
 - Fix trailing whitespace in test
 - Merge master
 - JDK-8075778: Add javadoc tag to avoid duplication of return information in simple situations.

Changes: https://git.openjdk.java.net/jdk/pull/1355/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1355&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8075778
  Stats: 526 lines in 15 files changed: 441 ins; 20 del; 65 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1355.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1355/head:pull/1355

PR: https://git.openjdk.java.net/jdk/pull/1355


More information about the compiler-dev mailing list