Trust final fields in records

Chris Hegarty chris.hegarty at oracle.com
Fri Jun 12 11:27:56 UTC 2020



> On 12 Jun 2020, at 11:57, Brian Goetz <brian.goetz at oracle.com> wrote:
> 
> If the fields cannot be made accessible, this means that 3rd party serialization frameworks will choke on records, right?  

Yes.

If a third-party serialization framework tries to set the fields of a record through reflection, and we explicitly disallow this, then is will fail.

Third-party serialization frameworks would have to (be updated to?) construct records in a similar way to that of Java Serialization, i.e. through an invocation of the record’s canonical constructor. This will obvious require a change in third-party serialization framework code. This may be fine, and what we actually want, but we should be explicit about it.

-Chris.



More information about the valhalla-dev mailing list