magic reflection access checks

Tom Rodriguez Thomas.Rodriguez at Sun.COM
Tue Aug 21 15:10:09 PDT 2007

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.

There is a later section of verify_class_access that checks for some other 
special cases that I guess you could get on the bootclasspath but I think those 
deal with access checks for inner classes which I don't think come in to play 
during our bootstrap.


Christian Thalinger wrote:
> On Tue, 2007-08-21 at 14:30 -0700, Tom Rodriguez wrote:
>> MagicAccessorImpl is loaded as part of our bootstrap in 
>> SystemDictionary::initialize_preloaded_classes.  verify_class_access will only 
>> try to use MagicAccessorImpl if this test fails:
>>    445     if ((current_class == NULL) ||
>>    446         (current_class == new_class) ||
>>    447         (instanceKlass::cast(new_class)->is_public()) ||
>>    448         is_same_class_package(current_class, new_class)) {
>>    449       return true;
>>    450     }
>> This test should never fail for any classes on the boot classpath so by the time 
>> any code needs a non null value we have it.  Do you have logic equivalent to this?
> Hmm, sorry, I don't see why this test should always be true for the boot
> classpath.  Could you explain a bit more?
> - twisti

More information about the hotspot-dev mailing list