RFR: JDK-8276964: Better indicate a snippet that could not be processed [v2]

Jonathan Gibbons jjg at openjdk.java.net
Mon Nov 29 19:09:11 UTC 2021


On Mon, 29 Nov 2021 18:44:11 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> It's not meant to be "part of the method spec", it's just that it's silly to display a summary/detail box unless you have something to show in the details. Think of it as a very trivial application of Postel's law. BTW, this kind of flexibility in choosing the appropriate container is one of the things that led me to choose `Optional` argument instead of overloaded methods. It just looks nicer to my eyes.
>
> I'd be inclined for either `detail` to be `Optional<Content>` or for there to be an overload that allows `Optional<String>` that calls the sibling with `Optional<Content>`

> it's just that it's silly to display a summary/detail box unless you have something to show in the details.

Agreed. This is just another case of whether it is better to assert/check that the input is sensible, or to silently do something reasonable in the face of unreasonable arguments.

If the arg was `Optional<Content>` instead of `Optional<String>` it would be more reasonable to just do the "null or blank" check on the string, and assume that the `Optional<Content>` is well-formed and sensible.

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

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


More information about the javadoc-dev mailing list