On Wed, 19 Aug 2026 18:01:29 GMT, Jorn Vernee <[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).
>
> test/jdk/java/lang/invoke/VarHandles/NullRestrictedValue.java line 28:
> 
>> 26:         return new NullRestrictedValue(a, b);
>> 27:     }
>> 28: }
> 
> I'm assuming another type is required since the regular `Value` can not be 
> used with null restricted fields?

Yes, we need a new key for the generator to generate null restricted cases.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32115#discussion_r3815517679

Reply via email to