magic reflection access checks
Tom Rodriguez
Thomas.Rodriguez at Sun.COM
Tue Aug 21 16:05:00 PDT 2007
I'm talking about during our bootstrap before we've generated any reflection
classes that it must be true so we never try to do the MagicAccessorImpl
subclass test. Once we're done with bootstrap MagicAccessorImpl is loaded so
the subclass tests work fine. You originally asked how we performed access
checks if MagicAccessorImpl wasn't loaded and the answer is that there's a very
small window during bootstrap where it isn't loaded and during that window it
isn't needed.
tom
Christian Thalinger wrote:
> On Tue, 2007-08-21 at 15:10 -0700, Tom Rodriguez wrote:
>> I agree that wasn't clear. We are only loading these classes at this point so
>> the access checks are only performed for supers and interfaces. Access checks
>> for those should always pass these tests, i.e we shouldn't be inheriting from
>> non public classes unless we are in the same package.
>
> Yes, we are in the same package, but the classloader is different:
>
> (gdb) p *cls->name
> $3 = {hashlink = 0x0, blength = 35, text = 0xa40f60 "sun/reflect/ConstructorAccessorImpl"}
> (gdb) p cls->classloader
> $4 = (classloader *) 0x0
> (gdb) p *referer->name
> $5 = {hashlink = 0xf6cf20, blength = 41, text = 0x10520d0 "sun/reflect/GeneratedConstructorAccessor1"}
> (gdb) p referer->classloader
> $6 = (classloader *) 0x787c00
>
> So the is_same_class_package-check can't be true.
>
> - twisti
More information about the hotspot-dev
mailing list