Clarifying record reflective support

Dan Smith daniel.smith at
Tue Dec 3 18:36:09 UTC 2019

> On Dec 3, 2019, at 10:15 AM, Brian Goetz <brian.goetz at> wrote:
> I am not even sure if “has a record attribute” isn’t overkill.  “Is a record class” is the more proper semantic specification, and it’s not clear to me that reflection api spec is the place to record these things.  

If the goal is to be vague about what we mean by "record class", then yes, no need for any details here or anywhere else. (In practice, this means: any class files that javac would output for a source-level 'record' are record classes, and among the set of classes that javac would not output, implementations should do something reasonable.)

If, on the other hand, the goal is to provide a precise definition of "record class" someplace else, I'm not sure where that would be. JVMS doesn't want to be discussing how a language-specific attribute must be interpreted by an API. JLS is pretty hands-off about class files (Chapter 13 makes some abstract assertions). Perhaps the definition belongs in the (nonexistent) compiler spec?

My general feeling about the reflection API is that it could do a better job of specifying behavior for the full space of class files, not just those produced by javac. I wouldn't mind a lot more discussion about class file artifacts like attributes. The API javadoc seems like the best place for this. But the status quo is to be vague, and if we're going to raise the bar on precision in reflection API documentation, that's best handled as an independent, holistic effort.

More information about the amber-spec-experts mailing list