-
CSR
-
Resolution: Withdrawn
-
P3
-
source
-
minimal
-
-
Language construct
-
SE
Summary
Record Classes were originally proposed by JEP 359 and were targeted to JDK 14 as a preview feature. The feature was previewed a second time by JEP 384, which was targeted to JDK 15. One of the most interesting features in record classes is how annotations applied to record components are propagated to elements generated from the record class declaration. Feedback has been positive but suggests that some additional restrictions on annotation propagation are needed.
Problem
The current record classes specification defines how annotations on record components are propagated, but in some circumstances (a combination of a particular targeted annotation and an explicit declaration of a particular associated member) an annotation can be lost by not being propagated anywhere. This will be counter-intuitive to developers.
Solution
Add new rules to the Java Language Specification capturing these problematic forms of annotated record class declarations, to ensure a compile-time error occurs when an annotation on a record component in a record class declaration would be lost.
Specification
Attached are all the specification documents related to records for context. But this CSR is specifically concerned about section: 8.10.5 Record Declarations and Annotations
of document: records-jls.html
- csr of
-
JDK-8253494 new restrictions on annotations of record components
-
- Closed
-