[sealed-classes] Spec for next version of Sealed Classes
Gavin Bierman
gavin.bierman at oracle.com
Wed Nov 4 17:50:23 UTC 2020
The permanent location for this spec is now:
http://cr.openjdk.java.net/~gbierman/jep397/latest/ <http://cr.openjdk.java.net/~gbierman/jep397/latest/>
(I have fixed the two issues that Chris spotted [1].)
Comments still welcome!
Gavin
[1] http://mail.openjdk.java.net/pipermail/amber-spec-experts/2020-October/002624.html
> On 23 Oct 2020, at 16:16, Gavin Bierman <gavin.bierman at oracle.com> wrote:
>
> Dear all:
>
> Drafts of the specs for the Sealed Classes feature that we plan to preview for
> a second time in JDK 16 are now available:
>
> http://cr.openjdk.java.net/~gbierman/8246775/latest/
>
> [NB: The URL will change once we have a JEP number, and will be announced.]
>
> The changes are the same as those in the first preview that was released in Java
> SE 15, except for minor editorial changes and the following:
>
> - Clarification the use of context when applying the lexical grammar,
> particularly in the identification of contextual keywords (formerly described
> as "restricted identifiers" and "restricted keywords"). This is detailed in a
> companion document entitled “Contextual Keywords". The keywords `sealed`,
> `non-sealed`, and `permits` are now defined as new instances of contextual
> keywords (3.9).
>
> - This spec now assumes that the changes detailed in companion documents
> entitled "Consistent Class and Interface Terminology” and "Local and Nested
> Static Declarations" have been applied (these are being introduced as part of
> the Records JEP). In particular, this means that Java SE 16 will support
> static declarations in two new positions:
>
> 1. Local, implicitly-static interfaces and enum classes
> 2. Static members of inner classes
>
> This requires asserting that local interfaces are not permitted to be
> `sealed`. (14.3)
>
> - To enhance narrowing reference conversion to allow for stricter checking of
> cast conversions with respect to sealed type hierarchies (5.1.6.1).
>
> - Local classes are not considered when determining implicitly declared
> permitted direct subclasses of a `sealed` class or `sealed` interface
> (8.1.6, 9.1.4).
>
>
> Comments welcome!
>
> Gavin
More information about the amber-spec-observers
mailing list