> De: "Brian Goetz" <brian.go...@oracle.com> > À: "Remi Forax" <fo...@univ-mlv.fr> > Cc: "amber-spec-experts" <amber-spec-experts@openjdk.java.net> > 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 Foo.class.getRecordComponents()[0].getDeclaredAnnotations() should report if the first component is deprecated or not. Rémi > On 1/9/2020 12:51 PM, [ mailto:fo...@univ-mlv.fr | fo...@univ-mlv.fr ] wrote: >>> De: "Brian Goetz" [ mailto:brian.go...@oracle.com | >>> <brian.go...@oracle.com> ] >>> À: "Remi Forax" [ mailto:fo...@univ-mlv.fr | <fo...@univ-mlv.fr> ] >>> Cc: "amber-spec-experts" [ mailto:amber-spec-experts@openjdk.java.net | >>> <amber-spec-experts@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