Revisiting default values

Dan Smith daniel.smith at oracle.com
Mon Jul 13 17:36:34 UTC 2020


From valhalla-spec-observers:

> On Jul 12, 2020, at 10:45 PM, Zheka Kozlov <orionllmain at gmail.com> wrote:
> 
> Sorry for a probably stupid question but aren't all classes from Bucket #2 and #3 ref-default? Which means when we are calling new LocalDate[10], all elements of the array are initialized to null. And since the constructors of these classes are private, the external user will never see the instances in their default state.

True, 'new LocalDate[10]' will continue to allocate an array of nulls. The default instance is only relevant when someone does 'new LocalDate.val[10]'.

Regardless of the syntax, if there exists an inline type for instances of an inline class ('LocalDate.val' above), there will also be a semantic question of how we initialize fields/arrays of that inline type.


More information about the valhalla-spec-observers mailing list