hotspot/src/share/vm/classfile/classFileParser.cpp
changeset 42574 25ff9171b28b
parent 41744 851a954c677d
child 42631 c9f65c500158
child 42639 762117d57d05
equal deleted inserted replaced
42573:a20695c30be5 42574:25ff9171b28b
  4347 
  4347 
  4348 static void check_super_class_access(const InstanceKlass* this_klass, TRAPS) {
  4348 static void check_super_class_access(const InstanceKlass* this_klass, TRAPS) {
  4349   assert(this_klass != NULL, "invariant");
  4349   assert(this_klass != NULL, "invariant");
  4350   const Klass* const super = this_klass->super();
  4350   const Klass* const super = this_klass->super();
  4351   if (super != NULL) {
  4351   if (super != NULL) {
       
  4352 
       
  4353     // If the loader is not the boot loader then throw an exception if its
       
  4354     // superclass is in package jdk.internal.reflect and its loader is not a
       
  4355     // special reflection class loader
       
  4356     if (!this_klass->class_loader_data()->is_the_null_class_loader_data()) {
       
  4357       assert(super->is_instance_klass(), "super is not instance klass");
       
  4358       PackageEntry* super_package = super->package();
       
  4359       if (super_package != NULL &&
       
  4360           super_package->name()->fast_compare(vmSymbols::jdk_internal_reflect()) == 0 &&
       
  4361           !java_lang_ClassLoader::is_reflection_class_loader(this_klass->class_loader())) {
       
  4362         ResourceMark rm(THREAD);
       
  4363         Exceptions::fthrow(
       
  4364           THREAD_AND_LOCATION,
       
  4365           vmSymbols::java_lang_IllegalAccessError(),
       
  4366           "class %s loaded by %s cannot access jdk/internal/reflect superclass %s",
       
  4367           this_klass->external_name(),
       
  4368           this_klass->class_loader_data()->loader_name(),
       
  4369           super->external_name());
       
  4370         return;
       
  4371       }
       
  4372     }
       
  4373 
  4352     Reflection::VerifyClassAccessResults vca_result =
  4374     Reflection::VerifyClassAccessResults vca_result =
  4353       Reflection::verify_class_access(this_klass, super, false);
  4375       Reflection::verify_class_access(this_klass, super, false);
  4354     if (vca_result != Reflection::ACCESS_OK) {
  4376     if (vca_result != Reflection::ACCESS_OK) {
  4355       ResourceMark rm(THREAD);
  4377       ResourceMark rm(THREAD);
  4356       char* msg =  Reflection::verify_class_access_msg(this_klass, super, vca_result);
  4378       char* msg =  Reflection::verify_class_access_msg(this_klass, super, vca_result);
  4357       if (msg == NULL) {
  4379       if (msg == NULL) {
  4358         ResourceMark rm(THREAD);
       
  4359         Exceptions::fthrow(
  4380         Exceptions::fthrow(
  4360           THREAD_AND_LOCATION,
  4381           THREAD_AND_LOCATION,
  4361           vmSymbols::java_lang_IllegalAccessError(),
  4382           vmSymbols::java_lang_IllegalAccessError(),
  4362           "class %s cannot access its superclass %s",
  4383           "class %s cannot access its superclass %s",
  4363           this_klass->external_name(),
  4384           this_klass->external_name(),