> The inline `{@return}` tag is relatively new and will require developers to > change their habits. According to the > [specification](https://docs.oracle.com/en/java/javase/17/docs/specs/javadoc/doc-comment-spec.html#return), > the inline version of `@return` "may only occur at the beginning of a > method's description". > > When used like in the description of the issue, the tag technically belongs > to the block `@param` tag and not to the body of the doc comment, which one > might think is the case. Thus, the "full body" (let alone "first sentence") > collection of doc nodes is empty. Hence, IndexOutOfBoundsException when > trying to access its first element. > > Since we don't have a method that returns the **complete** doc comment (yes, > "getFullBody" is a bit of a misleading name), whose first element we could > check against `{@return}`, I check `isEmpty()` before accessing the first > element. > > Interestingly, `{@summary}` (must also appear first) lint is performed > differently. However, I decided not to copy it since it operates on a lower > level of abstraction: characters and strings thereof.
Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision: Address feedback ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/7788/files - new: https://git.openjdk.java.net/jdk/pull/7788/files/20c26248..13342c8a Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=7788&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=7788&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/7788.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/7788/head:pull/7788 PR: https://git.openjdk.java.net/jdk/pull/7788