primary fields, reflection and annotations

Brian Goetz brian.goetz at
Wed Dec 6 15:20:01 UTC 2017

By default, the fields should not be private, but package-access, like 
other classes.  (You are permitted to upgrade them to public.)

But let's ignore the details for a minute, and ask: is a (non-type) 
annotation on a "field" of a record just a field annotation, or is it 
something more?

On 12/6/2017 10:10 AM, Remi Forax wrote:
> I suppose it's a good idea to support annotations on record fields,
>    record Person(@JSONProperty String name);
> at least the current prototype support that, it considers that the target is an ElementType.FIELD and copy the annotations to the generated fields.
> To access to the annotation sat runtime, you have to crawle the declared fields of the record which are private.
> And those annotations are not present as parameter annotation of the primary constructor.
> I think we should consider how we want to reflect on a record Class,
>    Do we want a java.lang.reflect.RecordField ?
>    Do we want a new annotation target RECORD_FIELD ?
> regards,
> Rémi

More information about the amber-spec-experts mailing list