JDK 14 record type representation in classfile format?

forax at univ-mlv.fr forax at univ-mlv.fr
Sat Mar 21 18:39:49 UTC 2020


> De: "Luke Hutchison" <luke.hutch at gmail.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "amber-dev" <amber-dev at openjdk.java.net>
> Envoyé: Samedi 21 Mars 2020 19:13:51
> Objet: Re: JDK 14 record type representation in classfile format?

> Sorry for posting to the wrong list.

not a big deal :) 

> On Sat, Mar 21, 2020 at 12:00 PM Remi Forax < [ mailto:forax at univ-mlv.fr |
> forax at univ-mlv.fr ] > wrote:

>> there is a link just below the JVM spec about record because as you said, it's a
>> preview feature
>> [ https://docs.oracle.com/javase/specs/jvms/se14/preview/specs/records-jvms.html
>> |
>> https://docs.oracle.com/javase/specs/jvms/se14/preview/specs/records-jvms.html
>> ]

> Thanks for the link. Records still define private fields.

so you can migrate your immutable classes to a record in a backward compatible way 

> Is there any reason to believe that the private fields listed in a record's
> classfile will not always have an exact 1:1 correspondence to
> record_component_info entries? i.e. is the information (names, types, arity,
> etc.) always exactly equivalent between both places ?

The JLS 8.10.3 [1] specifies that there is a 1:1 mapping between a record component, a field and an accessor method. 

regards, 
Rémi 

[1] https://docs.oracle.com/javase/specs/jls/se14/preview/specs/records-jls.html#jls-8.10.3 


More information about the amber-dev mailing list