I agree, PermittedSubtypes should only contains stable names. Rémi
----- Mail original ----- > De: "Brian Goetz" <brian.go...@oracle.com> > À: "amber-spec-experts" <amber-spec-experts@openjdk.java.net> > Envoyé: Mercredi 9 Octobre 2019 23:26:26 > Objet: [sealed] Sealed local classes? > It is allowable, though somewhat silly, to put the `final` modifier on > local classes. > > From a hierarchy-protection point of view, allowing local classes to be > `sealed` is also silly, as it cannot be extended from outside the method > anyway, and even if it could, such types can't show up in APIs that are > accessible from outside. > > From an exhaustiveness point of view, though, one can imagine having a > sealed local hierarchy (sum of records) that will be switched over > within the method, though one would have to work pretty hard to imagine > that. > > Note that a local class cannot be a subtype of a sealed type declared > outside the same method (*), since it can't be denoted in the permits > clause. > > (*) unless the permits clause is inferred. Yuck. Now a mangled name > would go into the PermittedSubtypes attribute. > > Proposal: ban `sealed` and `non-sealed` modifiers on _local_ classes and > interfaces.