JDK 14 record type representation in classfile format?

Brian Goetz brian.goetz at oracle.com
Sat Mar 21 20:59:48 UTC 2020


> Thanks for the link. Records still define private fields. 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?

Yes.  This is a forced move, as you need to be able to explicitly 
implement accessor methods, equals, etc, which mean the implementation 
needs access to the state, and it would be silly to put it anywhere 
other than fields with the names of the components.

record R(int x) {
     public int x() {
         println("X-ing!");
         return x;
     }
}




More information about the amber-dev mailing list