RFR: JEP 360: Sealed Types (Preview)

Kłeczek, Michał michal at kleczek.org
Wed Apr 15 12:32:02 UTC 2020


Hi Vicente,

IMHO there is one thing I think is worth pointing out in the 
documentation (as it is going to be cited on thousands of web sites):

One has to be very careful when exposing sealed types with only public 
permitted subtypes in public APIs.
Doing that makes it impossible to change the list of subtypes - both 
removal and adding of a subtype is an incompatible change.

I think it might be surprising for many library developers and I've 
raised the concerns about this before - maybe it is a good idea to make 
it more apparent.

Thanks,
Michal

On 13/04/2020 18:03:18, "Vicente Romero" <vicente.romero at oracle.com> 
wrote:

>Hi all,
>
>The sealed types JEP was already reviewed a while back when we were planning to include it in JDK14. It finally fell off that boat but it is being considered now for JDK15. There have been some changes since then mostly related to subtypes of a sealed type. Before we were planning to infer finality, sealness or non-sealness in the subtypes. We steered away from that direction in favor of explicit declaration at the subtype. I would like to ask for another review of the current version of the JEP that reflects these changes. The JEP is at [1] and the last version of the spec is at [2],
>
>Thanks,
>Vicente
>
>[1] https://bugs.openjdk.java.net/browse/JDK-8227043
>[2] http://cr.openjdk.java.net/~gbierman/jep360/jep360-20200228/specs/sealed-types-jls.html
>



More information about the amber-dev mailing list