Component deprecation (was: [records] Record updates for Preview/2)

forax at forax at
Fri Jan 10 22:19:07 UTC 2020

> De: "Brian Goetz" <brian.goetz at>
> À: "Remi Forax" <forax at>
> Cc: "amber-spec-experts" <amber-spec-experts at>
> Envoyé: Jeudi 9 Janvier 2020 18:57:58
> Objet: Component deprecation (was: [records] Record updates for Preview/2)

> The Deprecated attribute is, effectively, Deprecated. So I'm not interested in
> giving it any life support.
I think there is a confusion somewhere. 
The JVMS has no word about deprecating the attribute Deprecated, javac 14 is using it, so i don't understand. 

For me, a record component is at the same level as a field or a method, by example, they all have their own sub-attributes. 
Given that both a field and a method are using the attribute Deprecated, it is logical that a record component also uses the attribute Deprecated. 
The current state seems like a gratuitous discrepancy. 

So perhaps in the future, we may deprecate the attribute Deprecated but that's another story, for another time. 

> However, it is reasonable to allow the @Deprecated annotation on record
> components. And, you can apply it there now! And if you do, it will get
> propagated to fields, accessors, and constructor parameters, and reflection
> will reflect the right thing -- because its an annotation.
yes, but it will not be stored as a runtime visible annotation on a record component in the bytecode. 

> It is reasonable to add RECORD_COMPONENT to the target type, though not
> necessary. This would cause it to be propagated through to the Record
> attribute, where reflection would report it. I'm pretty not-interested in
> spending any spec or compiler effort on this, though. Its an annotation; we
> support annotations.
It's necessary 
should report if the first component is deprecated or not. 


> On 1/9/2020 12:51 PM, [ mailto:forax at | forax at ] wrote:

>>> De: "Brian Goetz" [ mailto:brian.goetz at | <brian.goetz at> ]
>>> À: "Remi Forax" [ mailto:forax at | <forax at> ]
>>> Cc: "amber-spec-experts" [ mailto:amber-spec-experts at |
>>> <amber-spec-experts at> ]
>>> Envoyé: Jeudi 9 Janvier 2020 16:07:50
>>> Objet: Re: [records] Record updates for Preview/2

>>>> - @Deprecated on record components

>>> Please outline what you think we want on a separate thread?
>> Currently you can not deprecate a record component unlike in Scala or in Kotlin.
>> We can either allow @Deprecated or pretend that people will never make mistake,
>> change their mind, specification will never change, etc

>> How to fix the issue,
>> - as Dmitry Bessonov said on the amber mailing list, the Deprecated annotation
>> should list ElementType.RECORD_COMPONENT as possible target.
>> - the JVMS should be changed to allow the attribute Deprecated on
>> record_component.

>> Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the amber-spec-experts mailing list