Sealed classes/interfaces were added to Java with JEP 360. The JVM-level change was to add a PermittedSubclasses attribute to class files, which can be used to explicitly list out which classes are allowed to extend a given class/interface.
- Is this information something an optimizing runtime can rely on (eg. can it be counted on to be precise/checked?)
- If the answer to 1 is "yes", do any widely used VMs actually use this? (Or are there any plans/papers about what is intended?)
I've read through the Sealed Classes SE15 spec change and I think the answer to 1 is "yes", but I couldn't find anything in the way of optimizations in https://github.com/openjdk/jdk.