Forward references in initializers
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon Nov 11 12:05:54 UTC 2024
I agree with this conclusion.
The main point here is that whether strict fields are initialized
before/after a super call is a very low-level detail that we'd like most
developers to happily ignore. But if the distinction surfaces up at the
level of DA/DU and field assignment, this is no longer strictly true,
and it is possible that some developers might be puzzled as a result,
and have to dig much deeper than they'd comfortable with to find exactly
why that is the case. Preserving the illusion that all fields are
created equal seems kind of nice, even though it is still an illusion.
Maurizio
On 08/11/2024 19:59, Dan Smith wrote:
> Conclusion: I think I'm happy with a DA/DU analysis that treats
> initializers as if they run in left-to-right order, before the start of
> the constructor. It's not really true, but it detects the errors we need
> to detect with less complexity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-observers/attachments/20241111/b4c1d815/attachment.htm>
More information about the valhalla-spec-observers
mailing list