RFR: 8289658: Avoid redundant LinkedHashMap.get call in TagletManager.addNewSimpleCustomTag [v2]

Jonathan Gibbons jjg at openjdk.org
Wed Jul 20 20:59:04 UTC 2022


On Wed, 20 Jul 2022 11:19:58 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java line 314:
>> 
>>> 312:             return;
>>> 313:         }
>>> 314:         Taglet tag = allTaglets.remove(tagName);
>> 
>> The logic was somewhat clearer before. This code may be correct, but it would help to have an explanatory comment.
>> Note this code is only executed once per run of javadoc, so performance is definitely not an issue.
>
> @jonathan-gibbons are you good with current code?

I reread the code in a more complete context, and the more detailed description in the doc comment for the method. The proposed comment isn't great, since it hints at the existence of a tag when there might not be one (i.e. `tag == null`).

The `then` part is sufficiently obvious, since the code is inserting a new `SimpleTaglet`, so ,I'd suggest to just enhance the `else` comment to:


// Move existing tag to the back

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

PR: https://git.openjdk.org/jdk/pull/9137


More information about the javadoc-dev mailing list