< prev index next >
src/hotspot/share/classfile/classFileParser.cpp
Print this page
rev 50800 : 8199940: Print more information about class loaders in IllegalAccessErrors.
Reviewed-by: lfoltan, mchung
@@ -4610,16 +4610,21 @@
ResourceMark rm(THREAD);
char* msg = Reflection::verify_class_access_msg(this_klass,
InstanceKlass::cast(super),
vca_result);
if (msg == NULL) {
+ bool same_module = (this_klass->module() == super->module());
Exceptions::fthrow(
THREAD_AND_LOCATION,
vmSymbols::java_lang_IllegalAccessError(),
- "class %s cannot access its superclass %s",
+ "class %s cannot access its %ssuperclass %s (%s%s%s)",
this_klass->external_name(),
- super->external_name());
+ super->is_abstract() ? "abstract " : "",
+ super->external_name(),
+ (same_module) ? this_klass->joint_in_module_of_loader(super) : this_klass->class_in_module_of_loader(),
+ (same_module) ? "" : "; ",
+ (same_module) ? "" : super->class_in_module_of_loader());
} else {
// Add additional message content.
Exceptions::fthrow(
THREAD_AND_LOCATION,
vmSymbols::java_lang_IllegalAccessError(),
@@ -4644,16 +4649,20 @@
ResourceMark rm(THREAD);
char* msg = Reflection::verify_class_access_msg(this_klass,
InstanceKlass::cast(k),
vca_result);
if (msg == NULL) {
+ bool same_module = (this_klass->module() == k->module());
Exceptions::fthrow(
THREAD_AND_LOCATION,
vmSymbols::java_lang_IllegalAccessError(),
- "class %s cannot access its superinterface %s",
+ "class %s cannot access its superinterface %s (%s%s%s)",
this_klass->external_name(),
- k->external_name());
+ k->external_name(),
+ (same_module) ? this_klass->joint_in_module_of_loader(k) : this_klass->class_in_module_of_loader(),
+ (same_module) ? "" : "; ",
+ (same_module) ? "" : k->class_in_module_of_loader());
} else {
// Add additional message content.
Exceptions::fthrow(
THREAD_AND_LOCATION,
vmSymbols::java_lang_IllegalAccessError(),
< prev index next >