On Wed, 24 Jun 2026 20:07:39 GMT, Jeremy Wood <[email protected]> wrote:

>> Calling `getAccessibleContext()` may in some cases replace the field 
>> `accessibleContext`. So we should use `getAccessibleContext()` here to make 
>> sure sure we have the most up-to-date AccessibleContext / DocumentListener.
>> 
>> 
>> ### Other Related Consideration
>> 
>> The `setDocument()` method includes analogous logic for 
>> `inputMethodRequestsHandler`. However `inputMethodRequestsHandler` is never 
>> reassigned outside of the JTextComponent class, so that shouldn't require a 
>> similar fix/change anytime soon.
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Jeremy Wood has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains seven additional 
> commits since the last revision:
> 
>  - 8385367: trying to fix whitespace for PR
>  - 8385367: moving fix to JEditorPane
>    
>    This is in response to:
>    https://git.openjdk.org/jdk/pull/31271#discussion_r3358850956
>  - 8385367: cleaning up test
>  - Merge branch 'master' into 8385367
>  - Merge branch 'openjdk:master' into master
>  - 8385367: make sure new DocumentListener is only added once
>    
>    In getAccessibleContext() when we create a new AccessibleContext: we 
> immediately add it as a DocumentListener to our Document.
>    
>    So in that case: setDocument(..) doesn't need to add a DocumentListener.
>  - 8385367: stop using stale/orphaned AccessibleContext

I'm running this updated version through our test  system.
I really doubt there's anything we have that would be affected but it is best 
to be sure.

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

PR Comment: https://git.openjdk.org/jdk/pull/31271#issuecomment-4794022384

Reply via email to