Sealed Types: JLS Changes (Draft)

OpenJDK recently announced a new draft language spec for sealed types

Following the recent announcement of the candidate JEP on sealed types (preview), Gavin Bierman's message "Draft JLS spec for sealed types" on the OpenJDK amber-spec-experts mailing list announces "a draft language spec for sealed types" and provides a link to that draft. That message also states: "This spec doesn't yet contain details on binary compatibility (Chapter 13) — to appear in the next draft."

You may also like: Candidate JEPs: Records and Sealed Types 

In this post, I highlight some of the proposed changes to the Java Language Specification (JLS) for sealed types. It is important to keep in mind the tentativeness of these proposed changes: this is an of JLS changes for a feature associated with a JDK Enhancement Proposal (JEP).

Candidate JEPs: Records and Sealed Types

Changes to records and sealed types were proposed in the most recent JDK Enhancement Proposals

Mark Reinhold announced two new closely related candidate JDK Enhancement Proposals (JEPs) on the OpenJDK amber-dev mailing list this week with the posts "New candidate JEP: 359: Records (Preview)" and " New candidate JEP: 360: Sealed Types (Preview)." Both of these candidate JEPs are "preview features" (defined by JEP 12).

In other JDK news: java.lang.Records: Draft Specification

JEP 359: Records (Preview)

The JEP 359 "Summary" states, "Enhance the Java programming language with records. Records provide a compact syntax for declaring classes which are transparent holders for shallowly immutable data."