On Fri, 31 Jul 2026 04:05:28 GMT, Chen Liang <[email protected]> wrote:

> The static field VarHandle is missing null checks that blocks incoming nulls.
> 
> The fix is simple; the overwhelming changes come from these areas:
> 1. To introduce a null-restricted set of fields and values, we need to use 
> early initialization and null-restricted array creation for our test 
> templates.
> 2. Added `test(InstanceField|StaticField|Array)NullPointerException` to 
> `VarHandleTest(MethodHandle|)AccessNullRestrictedValue` for the effective 
> unit tests. Without the patch, the `testStaticFieldNullPointerException` 
> fails.
> 
> ---------
> - [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: 77fd1033
Author:    Chen Liang <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/77fd103349df59ebd9ab4302b31c2936a3a2ff4e
Stats:     5410 lines in 39 files changed: 5262 ins; 9 del; 139 mod

8388448: VarHandle can set @NullRestricted static field to null

Reviewed-by: jvernee

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

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

Reply via email to