RFR: 8267329: Modernize Javadoc code to use instanceof with pattern matching [v2]
Pavel Rappo
prappo at openjdk.java.net
Wed May 19 11:31:42 UTC 2021
On Wed, 19 May 2021 04:03:03 GMT, Ian Graves <igraves at openjdk.org> wrote:
>> 8267329: Modernize Javadoc code to use instanceof with pattern matching
>
> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
>
> Typos
Ian, thanks for doing this carefully and for getting rid of superfluous null checks.
Opinion: prefer shorter binder names. `instanceof AVeryLongTypeName aVeryLongTypeName` feels verbose given the small scope of a binder. (You don't need to change anything.)
Update the copyright year.
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkOutputImpl.java line 55:
> 53: public void append(Object o) {
> 54: output.append(o instanceof String str ?
> 55: str : o.toString());
A briefer equivalent would look like this:
output.append(o.toString);
src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Messager.java line 71:
> 69: if (!(instance instanceof Messager messenger))
> 70: throw new InternalError("no messager instance!");
> 71: return messenger;
Every project has quirks. Out of many quirks of JavaDoc, we love this one the most. Perhaps you misread that type's name: it's Messager [sic!]. Please rename the variable either to `messager` or to a shorter one.
-------------
Changes requested by prappo (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/4105
More information about the javadoc-dev
mailing list