On Mon, 25 May 2026 07:15:05 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). This pull request has now been integrated. Changeset: bf7a7152 Author: Jeremy Wood <[email protected]> Committer: Phil Race <[email protected]> URL: https://git.openjdk.org/jdk/commit/bf7a71525024e21e250679299b9bb3448a02a859 Stats: 97 lines in 2 files changed: 97 ins; 0 del; 0 mod 8385367: JTextComponent#setDocument() can reattach old AccessibleContext Reviewed-by: prr, kizune ------------- PR: https://git.openjdk.org/jdk/pull/31271
