RFR: CSR Core-libs support for records

Chris Hegarty chris.hegarty at oracle.com
Tue Nov 5 09:37:20 UTC 2019



> On 4 Nov 2019, at 21:27, Florian Weimer <fw at deneb.enyo.de> wrote:
> 
> ...
> Right now, it appears to be possible to have a record implement
> java.io.Serializable, and serialization will appear to work, but
> because the names of the implicitly generated private fields are not
> specified, it is not portable across compilers and even compiler
> versions.


The private fields are specified. From 8.10.3 - Record Members [1]:

  ...
  For each record component appearing in the record component list:

	• An implicitly declared private final field with the same name as the record component and the type as the declared type of the record component. … 

-Chris.

[1] https://cr.openjdk.java.net/~gbierman/jep359/jep359-20191031/specs/records-jls.html#jls-8.10.3


More information about the amber-dev mailing list