On Sat, 31 Oct 2026 06:48:35 GMT, Jeremy Wood <[email protected]> wrote:

> This resolves the NPE reported in 8395930, and it enhances the preexisting 
> test for JDK-8381236 to cover this case.
> 
> The failing use case involves an Accessible object where 
> `axObj.getAccessibleContext() == null`. Having a `null` AccessibleContext is 
> an atypical case, but it is explicitly identified/allowed in the contract for 
> `Accessible.getAccessibleContext()`.
> 
> Prior to [8381236 
> changes](https://github.com/openjdk/jdk/pull/30578/changes), calling 
> CAccessible.getCAccessible(ax) would also fail with a NPE. So in this PR I'm 
> adding a boolean argument to control whether getCAccessible returns null or 
> throws a NPE. The legacy behavior will still throw a NPE, and the new 
> (getCAccessible) behavior returns null.
> 
> ---------
> - [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: c73d7d13
Author:    Jeremy Wood <[email protected]>
Committer: Alexander Zuev <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/c73d7d13aeea1caec275d9df6e429fc979339318
Stats:     35 lines in 2 files changed: 25 ins; 0 del; 10 mod

8395930: [macos] Accessible returning null from getAccessibleContext leads to a 
NullPointerException after JDK-8381236

Reviewed-by: kizune, prr

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

PR: https://git.openjdk.org/jdk/pull/33657

Reply via email to