Loosening requirements for super() invocation

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Jan 26 21:37:23 UTC 2023


On 26/01/2023 19:22, Archie Cobbs wrote:
> So what do you think then of only allowing access to /local/ fields 
> prior to super()?

By local fields I assume you mean "fields defined in the same class as 
constructor".

I doesn't change my opinion much, if I'm being honest. I'm skeptical of 
anything that can affect the observable initialization order of fields 
in a class.

For instance, even if we only allow updates to local fields, an instance 
initializer can now see these updates. for you, this is something good, 
for me this is just something else that developers would have to 
remember about initialization order.

Is it terrible? Probably not. Do we really need to go there? Probably 
not, either :-)

Maurizio

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230126/ef49ae12/attachment.htm>


More information about the amber-dev mailing list