[records] Latest spec available

Gavin Bierman gavin.bierman at oracle.com
Fri May 1 17:09:05 UTC 2020


I have updated this spec with the new restriction to compact constructors:

    It is a compile-time error if an assignment occurs (16) to a 
    field corresponding to a record component of the record class
    in the body of the compact constructor.

Latest spec available at:

    http://cr.openjdk.java.net/~gbierman/records2/20200501/specs/records-jls.html

Thanks,
Gavin

> On 28 Apr 2020, at 06:48, Gavin Bierman <gavin.bierman at oracle.com> wrote:
> 
> Dear all:
> 
> The latest draft of the spec for the second preview of records is available at:
> 
>  http://cr.openjdk.java.net/~gbierman/records2/20200428/specs/records-jls.html
> 
> The changes from the first preview spec [1] have been discussed on this list and
> are listed below for reference. However, with an eye to a better treatment of
> nesting in Java as discussed by Brian [2] we have taken the opportunity to
> refactor the spec somewhat to allow for a better treatment of local declarations
> including local records. 
> 
> We have kept these refactorings as two separate JLS change documents, linked to
> from the records spec. The first document clarifies the usage of terms related
> to classes and interfaces, and more clearly distinguishes them from types. The
> second builds on this and regularizes the treatment of nested and local
> declarations. In particular, it relaxes previous restrictions and permits *local
> interface and enum declarations*. The records spec then builds on top of these
> two changes to the JLS to support records (and local record declarations).
> 
> Comments welcome!
> Gavin
> 
> PS: The URLs will change once we have a JEP number for the second preview of
> records.
> 
> [1] http://cr.openjdk.java.net/~gbierman/jep359/jep359-20200115/specs/records-jls.html
> [2] https://mail.openjdk.java.net/pipermail/amber-spec-experts/2020-January/001904.html
> 
> Details: 
> 
> The changes are the same as those in the first preview of Records in Java SE 14,
> except for the following:
> 
> - All text now uses the terminology of "Consistent Class and Interface
> Terminology" spec change document
> 
> - The handling of local records now builds on the changes in "Local Static
> Interfaces and Enum Classes" spec change document
> 
> - Removed unnecessary change to 4.12.4
> 
> - 8.10.1: Removed possibility of `final` modifier for record components
> 
> - 8.10.1: Clarified that annotations on a record component only remain on the
> component if its annotation type is applicable in the record component context
> 
> - 8.10.1: Corrected text around use of `@SafeVarArgs` annotation
> 
> - 8.10.4: Removed requirement that canonical constructor must be `public`. Any
> access modifier must provide at least as much access as the record class. If a
> canonical constructor is implicitly declared, then its access modifier is the
> same as the record class.
> 
> - 8.10.4: Added requirement each formal parameter in the formal parameter list
> of the constructor must have the same name and type as the corresponding record
> component. The formal parameter must be a variable arity parameter if and only
> if the corresponding record component is a variable arity record component.
> 
> - 8.10.4 Added error condition if a field corresponding to a record component of
> a record class is neither DA nor DU in the body of a compact constructor.
> 
> - 9.6.4.4 New case for using `@Override` annotation to declare that a method is
> an accessor method for a record component.
> 



More information about the amber-spec-experts mailing list