The Record Attribute - What does it mean to be a record at runtime?

Dan Smith daniel.smith at oracle.com
Wed Nov 11 02:39:18 UTC 2020


> On Nov 10, 2020, at 1:51 PM, Chris Hegarty <chris.hegarty at oracle.com> wrote:
> 
> My issue is with how the VM determines whether a field is trusted or not. The VM trusts fields in (among other types) “record” classes. So what is a record class to the VM?   (that is the question that I am trying to resolve) - the answer is not in the JVMS ( which is fine ).

Suggestion: the VM shouldn't bother to provide any definition for "record class". That's up to Java language compilers and reflection (which should be in agreement).

Instead, can't we say the VM trusts fields in classes that have a Record attribute? Who cares whether those classes are "real" records or not? (I may be missing something because I don't fully understand the concept of "trusted final field", but it seems to me like HotSpot has a lot of freedom to decide to trust or not trust whatever fields it wants.)



More information about the amber-spec-experts mailing list