comparison src/hotspot/share/classfile/classFileParser.cpp @ 51450:a73848f8d0ad

8199940: Print more information about class loaders in IllegalAccessErrors. Reviewed-by: lfoltan, mchung
author goetz
date Wed, 27 Jun 2018 09:52:23 +0200
parents cb07f4b539fc
children a5557f24b4d4 9d49099287b1
comparison
equal deleted inserted replaced
34:b748b952f400 35:6b559084d7d0
4610 ResourceMark rm(THREAD); 4610 ResourceMark rm(THREAD);
4611 char* msg = Reflection::verify_class_access_msg(this_klass, 4611 char* msg = Reflection::verify_class_access_msg(this_klass,
4612 InstanceKlass::cast(super), 4612 InstanceKlass::cast(super),
4613 vca_result); 4613 vca_result);
4614 if (msg == NULL) { 4614 if (msg == NULL) {
4615 bool same_module = (this_klass->module() == super->module());
4615 Exceptions::fthrow( 4616 Exceptions::fthrow(
4616 THREAD_AND_LOCATION, 4617 THREAD_AND_LOCATION,
4617 vmSymbols::java_lang_IllegalAccessError(), 4618 vmSymbols::java_lang_IllegalAccessError(),
4618 "class %s cannot access its superclass %s", 4619 "class %s cannot access its %ssuperclass %s (%s%s%s)",
4619 this_klass->external_name(), 4620 this_klass->external_name(),
4620 super->external_name()); 4621 super->is_abstract() ? "abstract " : "",
4622 super->external_name(),
4623 (same_module) ? this_klass->joint_in_module_of_loader(super) : this_klass->class_in_module_of_loader(),
4624 (same_module) ? "" : "; ",
4625 (same_module) ? "" : super->class_in_module_of_loader());
4621 } else { 4626 } else {
4622 // Add additional message content. 4627 // Add additional message content.
4623 Exceptions::fthrow( 4628 Exceptions::fthrow(
4624 THREAD_AND_LOCATION, 4629 THREAD_AND_LOCATION,
4625 vmSymbols::java_lang_IllegalAccessError(), 4630 vmSymbols::java_lang_IllegalAccessError(),
4644 ResourceMark rm(THREAD); 4649 ResourceMark rm(THREAD);
4645 char* msg = Reflection::verify_class_access_msg(this_klass, 4650 char* msg = Reflection::verify_class_access_msg(this_klass,
4646 InstanceKlass::cast(k), 4651 InstanceKlass::cast(k),
4647 vca_result); 4652 vca_result);
4648 if (msg == NULL) { 4653 if (msg == NULL) {
4654 bool same_module = (this_klass->module() == k->module());
4649 Exceptions::fthrow( 4655 Exceptions::fthrow(
4650 THREAD_AND_LOCATION, 4656 THREAD_AND_LOCATION,
4651 vmSymbols::java_lang_IllegalAccessError(), 4657 vmSymbols::java_lang_IllegalAccessError(),
4652 "class %s cannot access its superinterface %s", 4658 "class %s cannot access its superinterface %s (%s%s%s)",
4653 this_klass->external_name(), 4659 this_klass->external_name(),
4654 k->external_name()); 4660 k->external_name(),
4661 (same_module) ? this_klass->joint_in_module_of_loader(k) : this_klass->class_in_module_of_loader(),
4662 (same_module) ? "" : "; ",
4663 (same_module) ? "" : k->class_in_module_of_loader());
4655 } else { 4664 } else {
4656 // Add additional message content. 4665 // Add additional message content.
4657 Exceptions::fthrow( 4666 Exceptions::fthrow(
4658 THREAD_AND_LOCATION, 4667 THREAD_AND_LOCATION,
4659 vmSymbols::java_lang_IllegalAccessError(), 4668 vmSymbols::java_lang_IllegalAccessError(),