If I understand the Valhalla proposed design [0], every primitive reference type `X` will have an associated primitive value type `X.val`, while every primitive value type `X` will have an associated primitive reference type `X.ref`. Which one gets to be called `X` is a function of how you declare it -- `primitive class X.val {}` gives primacy to the reference type.
So, if `Optional` will continue to be a reference type, you should be able to use `Optional.val` to use the associated value type.
I believe JEP 401 has not yet been updated to the new model,
there is no .val anymore, instead there are nullable value types and non nullable primitive types, only the latter has a .ref box because the former is a reference.
Optional will be retrofitted to a value class not a primitive class,
you get flattening but only on stack (parameter type or return type) not on heap (field).
I don't really understand the end of the part3 (the VM model), so i may be wrong.
So, if `Optional` will continue to be a reference type, you should be able to use `Optional.val` to use the associated value type.
[0] https://openjdk.java.net/jeps/401