Trust final fields in records

Kasper Nielsen kasperni at gmail.com
Tue Jun 16 10:08:28 UTC 2020


> One alternative might be an implicit static method parallel to the
> constructor that
> sets all field values, but does not execute any explicit constructor(s),
> if present.
> Sort of a 'raw' constructor.

Not having a 'raw' constructor that breaks encapsulation is a feature,
not an oversight [1].

/Kasper

[1] https://cr.openjdk.java.net/~briangoetz/amber/serialization.html


More information about the hotspot-runtime-dev mailing list