[sealed] Runtime checking of PermittedSubtypes
daniel.smith at oracle.com
Wed Apr 22 23:15:28 UTC 2020
> On Apr 22, 2020, at 4:48 PM, Alex Buckley <alex.buckley at oracle.com> wrote:
>>> 2a) If the superclass belongs to a different run-time module, error.
> As Remi says, by the time class loading happens, a layer has already been set up to map modules (and hence their packages) to loaders. JVMS 5.3.6 discusses this, including the possibility that a class is "in a run-time module".
Okay, so it would be valid to talk about "the run-time module of C" while C is being derived?
I think this sentence from 5.3.6 anticipates this sort of early query, but I might be misinterpreting the parenthetical:
"We say that a class is in a run-time module iff the class's run-time package is associated (or will be associated, if the class is actually created) with that run-time module."
I'm a little nervous about the idea that some associations haven't happened yet. I'm not clear on the timing.
More information about the amber-spec-experts