Experience with sealed classes & the "same package" rule

Remi Forax forax at univ-mlv.fr
Tue Jun 22 09:08:23 UTC 2021


> De: "John Rose" <john.r.rose at oracle.com>
> À: "Maurizio Cimadamore" <maurizio.cimadamore at oracle.com>
> Cc: "daniel smith" <daniel.smith at oracle.com>, "amber-spec-experts"
> <amber-spec-experts at openjdk.java.net>
> Envoyé: Mardi 22 Juin 2021 02:31:13
> Objet: Re: Experience with sealed classes & the "same package" rule

> That argument does not make sealing
> less useful or more dangerous in a
> non-modular setting, in a manner
> unique to sealing. So, I still fail to see
> why the proposed simplification has
> any downside at all.

The proposed simplification allows different packages to share different part of the sealed hierarchy without a module. 
So those packages can be in different jars, compiled at different times. 
This will produce "impossible" sealed hierarchies where by example two types are both permitted subtypes of each other. 

We can save a lot of test and debugging time to a lot of people by avoiding split sealed hierarchy. 

> — John

Rémi 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20210622/444f15c1/attachment.htm>


More information about the amber-spec-experts mailing list