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

Brian Goetz brian.goetz at oracle.com
Thu Jan 9 17:57:58 UTC 2020


The Deprecated attribute is, effectively, Deprecated.  So I'm not 
interested in giving it any life support.

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.

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.

On 1/9/2020 12:51 PM, forax at univ-mlv.fr wrote:
>
>
> ------------------------------------------------------------------------
>
>     *De: *"Brian Goetz" <brian.goetz at oracle.com>
>     *À: *"Remi Forax" <forax at univ-mlv.fr>
>     *Cc: *"amber-spec-experts" <amber-spec-experts at openjdk.java.net>
>     *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: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20200109/8c953072/attachment-0001.htm>


More information about the amber-spec-experts mailing list