RFR: JDK-8267394: Do not rely on object identity for empty valid Content instance
Jonathan Gibbons
jjg at openjdk.java.net
Thu Jun 3 14:31:40 UTC 2021
On Thu, 20 May 2021 14:31:33 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
> This is a simple cleanup to replace the sentinel `HtmlTree.EMPTY` text constant with an instance that achieves the same by overriding `isValid()`. I think this is the nicer solution, and it allows us to remove the special case identity check in `HtmlTree.add(Content)`.
Agreed to leave this for now.
I think we can incrementally go after sites that are creating invalid nodes.
I don't see why it is so bad to use a sentinel value to mark "temporarily empty" nodes, but I do think it's an error than the name of the sentinel suggests it can be used for other purposes -- i.e. as a general purpose "empty" node.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4130
More information about the javadoc-dev
mailing list