Revisiting default values

Brian Goetz brian.goetz at oracle.com
Thu Jul 1 12:48:19 UTC 2021


>
> Which reminds me:  I think we should
> allow calls to methods on `this` inside a
> constructor.  (Do we?)  A clean way to
> statically exclude incomplete values of `this`
> would be to outlaw such self-calls until all
> final fields are definitely assigned.  The
> current language (for identity classes)
> computes this point (of complete field
> assignment) in order to enforce the rule
> that the constructor cannot return until
> all final fields have been definitely assigned.

FYI: A recent paper on the self-use-from-constructor problem: 
https://dl.acm.org/doi/10.1145/3428243




More information about the valhalla-spec-observers mailing list