JDK-8254331 : New restrictions on annotations on record components
  • Type: CSR
  • Component: tools
  • Sub-Component: javac
  • Priority: P3
  • Status: Closed
  • Resolution: Withdrawn
  • Fix Versions: 16
  • Submitted: 2020-10-09
  • Updated: 2020-10-19
  • Resolved: 2020-10-19
Related Reports
CSR :  
Description
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`

Comments
[~darcy] sure I will, as soon as I know the outcome
16-10-2020

[~vromero], if the EG determines not be proceed on this issue, please move the issue to Closed - Withdrawn.
14-10-2020

[~darcy] please disregard this one for the time being. The issue is being discussed with the EG.
14-10-2020

Moving to Provisional, not Approved. Please indicated *specifically* what is proposed to change from the previously review iterations of records. Having the entirety of records resubmitted is not especially helpful for review.
13-10-2020