Experience with sealed classes & the "same package" rule

Remi Forax forax at univ-mlv.fr
Wed Jun 9 23:27:17 UTC 2021

> De: "John Rose" <john.r.rose at oracle.com>
> À: "daniel smith" <daniel.smith at oracle.com>
> Cc: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Jeudi 10 Juin 2021 00:29:40
> Objet: Re: Experience with sealed classes & the "same package" rule
> (Also on the same hit-list: The restriction against
> using local sealed hierarchies. The restriction
> doesn’t make any sense, logically. And it is a
> sharp edge when you copy-and-paste a hierarchy
> as a unit.)

yes, local sealed hierarchies should be allowed if they are inside the same scope, it's infuriating to have to move the hierarchy as members of the class when you want to write a unit test with everything confined in the same method. 
The same also goes for annotations which are not allowed to be local likewise you can not declare them inside a method of a unit test. 

> — John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20210610/49c9b296/attachment.htm>

More information about the amber-spec-experts mailing list