RFR: JDK-8267394: Do not rely on object identity for empty valid Content instance

Jonathan Gibbons jonathan.gibbons at oracle.com
Wed Jun 2 14:32:31 UTC 2021


On 6/2/21 7:13 AM, Hannes Wallnöfer wrote:
> On Tue, 1 Jun 2021 16:03:49 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>
>>> Can we take the bigger step and make it unnecessary to have/use `isValid`?  We should never knowingly create nodes that will be invalid by whatever metric we choose to define validity.  If there's a risk of creating nodes that will end up being invalid, we should do the work ahead of time to not create the nodes in the first place.
>>>
>>> Bottom line, the original reasons for `isValid` were, at best, flawed. Is this the time to fix that?
>>> Can we take the bigger step and make it unnecessary to have/use `isValid`?
>> Yes.
>>
>>> the original reasons for `isValid` were, at best, flawed. Is this the time to fix that?
>> When you say "time", do you mean "this PR" or "physical time"? If you meant the latter, then I find it hard to imagine a simple and correct fix that would also fit in the JDK 17 timeframe.
> I agree that our current `isValid` implementation does not feel right.
>
> But there are many (dozens?) of places in the code that potentially generate empty elements. If we want to avoid these, shifting the responsability to the content producer will blow up the code a lot. I'm trying out different things to see if I can come up with a better solution.

Do we have any sense of how often the "isValid" check prevents an empty 
node to be added to the tree?



>
> -------------
>
> PR: https://git.openjdk.java.net/jdk/pull/4130


More information about the javadoc-dev mailing list