RFR: 8289658: Avoid redundant LinkedHashMap.get call in TagletManager.addNewSimpleCustomTag [v2]
Andrey Turbanov
aturbanov at openjdk.org
Wed Jul 6 16:19:42 UTC 2022
On Mon, 4 Jul 2022 16:58:05 GMT, Attila Szegedi <attila at openjdk.org> wrote:
>> Hm. For me the previous code is confusing. Subsequent remove+put by the same key looks like some leftovers after refactoring.
>> Javadoc of this method is very explanatory. New code just repeats what is written there. Not sure if additional comment required.
>
> In a context of a linked hash map, remove+put has the effect of reordering. In your refactor there's still a remove+put on the same key, you essentially just hoisted the two common occurrences from both branches to outside the if statement.
>
> Not to _necessarily_ appeal to authority, but Jon is a true multi-decade veteran of Java language tooling and knows more about Javadoc than most of us combined, so if all he asks for is a comment, I'd add a comment :-). Maybe something to the effect of
>
>
> // remove + put in both branches below move the tag to the back of the map's ordering
comment added
-------------
PR: https://git.openjdk.org/jdk/pull/9137
More information about the javadoc-dev
mailing list