Record construction

Brian Goetz brian.goetz at oracle.com
Wed Mar 14 16:28:57 UTC 2018


> If we go with choice (b), I would recommend that it be amended to read:
>
> (b) If the corresponding field is definitely initialized by the explicit constructor body, leave it out of the implicit initialization code;
>      if the corresponding field is definitely not initialized by the explicit constructor body, put it in the implicit initialization code;
>      and in all other cases it is a compile-time error.
>
> This is to defend against code such as
>
>      record Point(int x, int y) {
>          Point {
>              if (x > 0) this.y = x;
>          }
>      }

Yes, that was the intent -- thanks for making this explicit.  So DA -- 
OK, DU -- OK, but neither -- not OK.




More information about the amber-spec-experts mailing list