It is possible to define sealed
classes in Scala, which are basically final
except if the sub-classing happens in the same file.
It seems that the JVM doesn't allow final
class bytecode and subclasses of it.
Considering that there is no "notion" of source file in the bytecode, how is this restriction enforced?
Therefore, how can javac
prevent a Scala sealed
class from being sub-classed in Java?