Review Request JDK-8206121: [lworld] ensure non-nullable on setting value field via reflection and VarHandle
paul.sandoz at oracle.com
Thu Jul 5 18:29:54 UTC 2018
It looks reasonable as an initial solution but i think the right long term solution should be for Class.cast to fail. Perhaps that is already tracked under a different issue?
Both the VarHandle code and the LF code perform cast checks for refs so we should be able to piggy back off them for values without an explicit null check.
130 if (c.isValue())
? AFAICT you are not checking finality of a value type held in a ref but the the assignment of null.
> On Jul 5, 2018, at 9:02 AM, mandy chung <mandy.chung at oracle.com> wrote:
> Webrev at:
> Add null check in value field access in LambdaForm for DMH and VarHandle. For DMH, a new FT_CHECK_VALUE kind indicates that
> a value field requires a null check. A value may be flattened
> or non-flattened that will use the linker method with and without
> the field type. So adjust the way to compute the index to the
> ACCESSOR_FORMS cache as it will have a different LF for flattened
> and non-flattened value field. The test verifies nullability
> and immutability.
More information about the valhalla-dev