Record Component attributes
forax at univ-mlv.fr
forax at univ-mlv.fr
Wed Oct 9 16:44:23 UTC 2019
----- Mail original -----
> De: "Brian Goetz" <brian.goetz at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>, "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Mercredi 9 Octobre 2019 17:59:56
> Objet: Re: Record Component attributes
>> just to be sure, do we agree that a record component can be deprecated,
>> synthetic, have a generic signature, have unknown attributes, have annotation
>> and type annotations ?
> Deprecated: not clear what this would mean, since removing a component
> is not a BC or SC change, and therefore removal seems unlikely, but I
> suppose deprecation could be a "stay away" warning sign for that
> component? On the fence.
> Synthetic: I think this is a no. The philosophy is: a record is a class
> whose representation and API are both derived from the state
> description. Having a synthetic component would be weird (same reason
> we don't have inner records.)
> Generic signature: yes, definitely.
> Unknown attributes: I believe that Dan had an opinion here, as reflected
> in the current spec draft?
> Declaration and type annotations: yes, definitely.
given it's the class format representation, i will wear my JVM runtime implementer hat :
There a lot of languages that have default value for parameters, so for constructor parameters,
for those it makes sense to be able to deprecate a record component if at the same time you provide a default value for this component.
for synthetic, a synthetic component is a component that the VM (or the reflection) sees but that javac doesn't see. Reified generics stored as parameter like in Swift is a case where you may not want javac to see your ugly refiied type/witness type/etc.
>> so the attributes with a special meaning are
>> SIGNATURE, DEPRECATED, SYNTHETIC, RUNTIME_VISIBLE_ANNOTATIONS,
>> RUNTIME_VISIBLE_TYPE_ANNOTATIONS, RUNTIME_INVISIBLE_ANNOTATIONS and
>> said differently, it's all the attributes allowed on a field but CONSTANTVALUE
>> which makes no sense on a record component.
> > Rémi
More information about the amber-spec-experts