[Nestmates] Add a core reflection API to get nestmate information
peter.levart at gmail.com
Mon Nov 20 09:39:19 UTC 2017
On 11/20/2017 10:20 AM, Peter Levart wrote:
> Your comment in the issue:
> ...describes how access checking for private members behaves in VM and
> what are the outcomes when class attributes are missing or not
> consistent (access is denied - IllegalAccessError is thrown) vs. when
> nest-host class can not be resolved (NoClassDefFoundError is thrown).
> I think this is sound.
I found a wording in the spec update that maybe requires some
explanation. This is the relevant part:
/A class or interface H grants nest membership to a class or interface D
if H is declared in the same run-time package as D, H has a NestMembers
attribute (4.7.29), and there is some value j in the classes array of
the NestMembers attribute of H, such that item j of the run-time
constant pool of H is a symbolic reference to D. //
// Because H belongs to the same run-time package as D, it is not
necessary to resolve a symbolic reference in H in order to determine
whether it references D. It is only necessary to check the unresolved name./
What does it mean that "H belongs to the same run-time package as D"?
Does it mean that package names of H and D are equal, or does it also
imply that both H and D are loaded by the same class loader? While
jigsaw makes the class loader check unnecessary (either H and D are in
the same module and consequently loaded by same class loader or H is not
resolvable from D when they share package name), java still has plain
ClassLoader(s) and does not always guarantee the absence of split packages.
More information about the valhalla-spec-observers