Draft JLS spec for records
Anthony Vanelverdinghe
anthonyv.be at outlook.com
Fri Aug 30 19:26:22 UTC 2019
Hi Vijay
In the JLS grammar notation [1], {x} denotes zero or more occurrences of
x, so there are no constraints on the number of annotations.
[1] https://docs.oracle.com/javase/specs/jls/se12/html/jls-2.html#jls-2.4
Kind regards,
Anthony
On 27/08/2019 15:32, Vijay Lakshminarayanan wrote:
> 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