On Mon, 23 Aug 2021 20:20:19 GMT, Jonathan Gibbons <[email protected]> wrote:
>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java
>> line 528:
>>
>>> 526: * @return a content tree for the text
>>> 527: */
>>> 528: public List<? extends DocTree> getComment(String key, Object o0,
>>> Object o1, Object o2) {
>>
>> What is the purpose of this rather complex method to format a text resource?
>> It seems like it is arguments `o1` and `o2` are never used. Couldn't this be
>> implemented simply using `MessageFormat` as it used to be?
>
>> What is the purpose of this rather complex method to format a text resource?
>> It seems like it is arguments `o1` and `o2` are never used. Couldn't this be
>> implemented simply using `MessageFormat` as it used to be?
>
> This is the `DocTree` equivalent of similar code in `Content`, to format
> structured objects into a format string. Previously, using `MessageFormat`,
> the code used "regular" text to inject the name of the property. Now, using
> this new code, we can inject the equivalent of `{@code _name_ }`.
>
> Yes, it is currently a bit more general than strictly required, in that
> currently we only require a single value to be injected. I guess I was just
> following the pattern of supporting future use.
Thanks for the explanation. Sounds reasonable.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5102