Draft JLS spec for records

Vijay Lakshminarayanan laksvij at hawk.iit.edu
Tue Aug 27 13:32:55 UTC 2019


Hi Gavin

>From the spec it seems there may be only one annotation against a
RecordComponent or against a constructor.

>From 8.10.1 Record Header

> RecordComponent: {Annotation} UnannType Identifier

and from 8.10.2

> CompactConstructorDeclaration: {Annotation} {ConstructorModifier} [TypeParameters] SimpleTypeName [Throws] ConstructorBody

Wouldn't the following be legal?

record NonNullName(@NotNull @NotModified StringBuilder name) {
    @JsonCreator @XmlCreator @BsonCreator public NonNegativePoint { ... }
}

Thanks
Vijay

On Tue, Aug 27, 2019 at 6:12 PM Gavin Bierman <gavin.bierman at oracle.com> wrote:
>
> Added.
>
> > On 26 Aug 2019, at 16:25, Brian Goetz <brian.goetz at oracle.com> wrote:
> >
> >> The listing of serialPersistentFields seems fine too, again possible collision with the record component field.
> >>
> >> serialVersionUID is static, so doesn't need to need to be listed. Ok.
> >
> > You can’t have two fields with the same name, even if one is static and the other is not. So sVUID should stay on the list.
> >
>


More information about the amber-spec-observers mailing list