On Wed, 17 Jan 2024 00:24:01 GMT, Jonathan Gibbons <[email protected]> wrote:
>> src/jdk.compiler/share/classes/com/sun/source/doctree/RawTextTree.java line
>> 40:
>>
>>> 38: * @apiNote
>>> 39: * This class may be used to represent tree nodes containing
>>> 40: * {@linkplain DocTree.Kind#MARKDOWN Markdown} text.
>>
>> This means that there is one-to-many relationship between `RawTextTree` and
>> `DocTree.KIND`. This in turn perpetuates the pattern of checking the kind
>> followed by casting as opposed to more modern `instanceof` pattern matching.
>> There's nothing wrong with it per se, however I wonder what the rationale is
>> for leaving this part of the API open-ended. Is it to support other types of
>> raw text in the future?
>
> Yes, the thinking was to allow it to be open-ended.
>
> In this case, while I think we should specify the ability to use
> `instanceof`-style checks with this API, I do not think it would be necessary
> ... there is no need for a subtype for `MarkdownTree`, nor would I expect
> there to be one for any other kind of raw text.
Related: filed [JDK-8324877](https://bugs.openjdk.org/browse/JDK-8324877) to
better specify the 1-1 relationship between subtypes of `DocTree` and members
of `DocTree.Kind`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16388#discussion_r1470351155