Semantics of an empty PermittedSubtypes attribute for the VM

forax at forax at
Thu Apr 2 21:58:28 UTC 2020

----- Mail original -----
> De: "Brian Goetz" <brian.goetz at>
> À: "Remi Forax" <forax at>
> Cc: "amber-spec-experts" <amber-spec-experts at>
> Envoyé: Jeudi 2 Avril 2020 23:31:23
> Objet: Re: Semantics of an empty PermittedSubtypes attribute for the VM

>>> At the language level, we won’t let you define a class with an empty set of
>>> permitted types; you should define a final class instead.
>>> But, having the VM treat an empty PS attribute as if it were not there seems
>>> wrong; I would think an empty PS attribute would be a class file error.
>> For comparison, i believe the VM also allows attribute NestMembers or
>> BootstrapMethods to be empty.
> True.  But the semantics of these are not ambiguous, as they are with
> PS.   An empty "NestMembers" attribute, and no "NestMembers" attribute,
> have the same effect -- no nest members.  But an empty PermittedSubtypes
> attribute means (in the absence of ACC_FINAL) anything goes.  So we have
> two things to be "consistent" with:
>  - No PS means no restriction.  And an empty PS should be like no PS,
> right?  So empty PS is "no restrictions."
>  - PS == list of permited subtypes, so empty PS is "no permitted subtypes."
> Given that these things are on a collision course, and there's no need
> to have an empty PS, better to make an empty PS illegal.

yes, make sense.


More information about the amber-spec-experts mailing list