< prev index next >

src/hotspot/share/classfile/classFileParser.cpp

Print this page




4492 static void check_super_class_access(const InstanceKlass* this_klass, TRAPS) {
4493   assert(this_klass != NULL, "invariant");
4494   const Klass* const super = this_klass->super();
4495   if (super != NULL) {
4496 
4497     // If the loader is not the boot loader then throw an exception if its
4498     // superclass is in package jdk.internal.reflect and its loader is not a
4499     // special reflection class loader
4500     if (!this_klass->class_loader_data()->is_the_null_class_loader_data()) {
4501       assert(super->is_instance_klass(), "super is not instance klass");
4502       PackageEntry* super_package = super->package();
4503       if (super_package != NULL &&
4504           super_package->name()->fast_compare(vmSymbols::jdk_internal_reflect()) == 0 &&
4505           !java_lang_ClassLoader::is_reflection_class_loader(this_klass->class_loader())) {
4506         ResourceMark rm(THREAD);
4507         Exceptions::fthrow(
4508           THREAD_AND_LOCATION,
4509           vmSymbols::java_lang_IllegalAccessError(),
4510           "class %s loaded by %s cannot access jdk/internal/reflect superclass %s",
4511           this_klass->external_name(),
4512           this_klass->class_loader_data()->loader_name(),
4513           super->external_name());
4514         return;
4515       }
4516     }
4517 
4518     Reflection::VerifyClassAccessResults vca_result =
4519       Reflection::verify_class_access(this_klass, InstanceKlass::cast(super), false);
4520     if (vca_result != Reflection::ACCESS_OK) {
4521       ResourceMark rm(THREAD);
4522       char* msg = Reflection::verify_class_access_msg(this_klass,
4523                                                       InstanceKlass::cast(super),
4524                                                       vca_result);
4525       if (msg == NULL) {
4526         Exceptions::fthrow(
4527           THREAD_AND_LOCATION,
4528           vmSymbols::java_lang_IllegalAccessError(),
4529           "class %s cannot access its superclass %s",
4530           this_klass->external_name(),
4531           super->external_name());
4532       } else {




4492 static void check_super_class_access(const InstanceKlass* this_klass, TRAPS) {
4493   assert(this_klass != NULL, "invariant");
4494   const Klass* const super = this_klass->super();
4495   if (super != NULL) {
4496 
4497     // If the loader is not the boot loader then throw an exception if its
4498     // superclass is in package jdk.internal.reflect and its loader is not a
4499     // special reflection class loader
4500     if (!this_klass->class_loader_data()->is_the_null_class_loader_data()) {
4501       assert(super->is_instance_klass(), "super is not instance klass");
4502       PackageEntry* super_package = super->package();
4503       if (super_package != NULL &&
4504           super_package->name()->fast_compare(vmSymbols::jdk_internal_reflect()) == 0 &&
4505           !java_lang_ClassLoader::is_reflection_class_loader(this_klass->class_loader())) {
4506         ResourceMark rm(THREAD);
4507         Exceptions::fthrow(
4508           THREAD_AND_LOCATION,
4509           vmSymbols::java_lang_IllegalAccessError(),
4510           "class %s loaded by %s cannot access jdk/internal/reflect superclass %s",
4511           this_klass->external_name(),
4512           this_klass->class_loader_data()->loader_name_and_id(),
4513           super->external_name());
4514         return;
4515       }
4516     }
4517 
4518     Reflection::VerifyClassAccessResults vca_result =
4519       Reflection::verify_class_access(this_klass, InstanceKlass::cast(super), false);
4520     if (vca_result != Reflection::ACCESS_OK) {
4521       ResourceMark rm(THREAD);
4522       char* msg = Reflection::verify_class_access_msg(this_klass,
4523                                                       InstanceKlass::cast(super),
4524                                                       vca_result);
4525       if (msg == NULL) {
4526         Exceptions::fthrow(
4527           THREAD_AND_LOCATION,
4528           vmSymbols::java_lang_IllegalAccessError(),
4529           "class %s cannot access its superclass %s",
4530           this_klass->external_name(),
4531           super->external_name());
4532       } else {


< prev index next >