----- Mail original ----- > De: "Brian Goetz" <brian.go...@oracle.com> > À: "Remi Forax" <fo...@univ-mlv.fr> > Cc: "amber-spec-experts" <amber-spec-experts@openjdk.java.net> > Envoyé: Jeudi 1 Avril 2021 22:32:23 > Objet: Re: [External] : Re: Possible refinement for sealed classes
>> By example, a type WithCheese may make little sense. >> Anyway, if WithCheese only makes sense for a Sandwich, nesting >> WithCheese inside Sandwich is the way to go. > > This doesn't help unless the *whole* hierarchy is nested in the same > file. Otherwise you have to have an explicit permits clause on each of > Sandwich, WIthCheese, etc. The whole public hierarchy, you can still have an interface inside the compilation unit and a non visible implementation in another file. Rémi