Class.getRecordComponent() javadoc doesn't specify its behavior if the accessor of a record component is not present

Remi Forax forax at univ-mlv.fr
Thu Oct 10 21:34:31 UTC 2019


switch to amber-spec-experts, because it's about the binary representation of a Record in the classfile.

----- Mail original -----
> De: "Maurizio Cimadamore" <maurizio.cimadamore at oracle.com>
> À: "Harold David Seigel" <harold.seigel at oracle.com>, "amber-dev" <amber-dev at openjdk.java.net>
> Envoyé: Jeudi 10 Octobre 2019 22:03:23
> Objet: Re: Class.getRecordComponent() javadoc doesn't specify its behavior if the accessor of a record component is not
> present

> It's the usual question: do we fail when we access things reflectively
> that don't seem to be there (either fully or partially) ? Or do we
> silently ignore?
> 
> I know that we have examples of both; for instance, nestmates went the
> 'throw an exception' path if a member of the nest cannot be found; but
> annotations went a different path, and annotations that are not found
> are simply discarded.
> 
> One might argue that annotations are 'metadata' so less crucial than
> properties such as record component-ness or nestmate-ness. But still
> there's a choice.
> 
> And, whatever we do, we should probably be consistent with any kind of
> error that could popup when parsing the record component attribute, such
> as illegal modifiers and such. But, I guess for missing annotations on a
> record component we should be consistent with the rest of the JDK, and
> just drop them on the floor.

Technically a record component as no modifier, and yes this worry me a bit because it's not very future proof,
we may decide to add null/non-null keywords later, that said, we can still use a new attribute (an attribute of the record component) for that.

> 
> Maurizio

Rémi


More information about the amber-spec-experts mailing list