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.

Reply via email to