On Thu, 2 Apr 2026 02:54:08 GMT, Sergey Bylokhov <[email protected]> wrote:

>> When you say "drop the current accessibleContext" do you mean simply nullify 
>> `JTextComponent.accessibleContext`?
>> 
>> Or are you talking about detaching DocumentListeners? (Or something else?)
>
> I guess the accessibleContext is tied to the type of the document, so if the 
> document is changed the accessibleContext should be updated/reset as well, 
> correct?

Sorry this delay.

I rewrote the test, so hopefully it now covers more ground (in a more clear 
way). Specifically for your question I added [this 
test](https://github.com/openjdk/jdk/pull/30401/changes#diff-5b5087bc0acb0dae3c480443959d5c6a6504919d7db045e8ff1ff18f672307ffR105):
 here I alternate changing the Document and make sure that we don't end up with 
too many DocumentListeners.

(There's also a stand-alone unit test for the original complaint, and a 
stand-alone unit test for prrace's complaint.)

Does this test satisfy your question?

I also wrote a [fourth unit 
test](https://github.com/mickleness/jdk/compare/8380790...mickleness:jdk:8380790C?expand=1)
 in a separate branch: this fourth test constantly reassigns the _same_ 
HTMLDocument. If anyone wants to discuss that further we can, but it feels 
increasingly far removed from the problem this ticket is trying to address.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/30401#discussion_r3143061392

Reply via email to