8238175: CTW: Class.getDeclaredMethods fails with assert(k->is_subclass_of(SystemDictionary::Throwable_klass())) failed: invalid exception class

Replace the assert with a logging message saying that the class is not a subclass of java.lang.Throwable

Reviewed-by: dholmes, coleenp
This commit is contained in:
Harold Seigel 2020-02-13 15:43:59 +00:00
parent 2ac2d590c2
commit d298a05d02
3 changed files with 243 additions and 1 deletions

View file

@ -811,7 +811,13 @@ objArrayHandle Method::resolved_checked_exceptions_impl(Method* method, TRAPS) {
for (int i = 0; i < length; i++) {
CheckedExceptionElement* table = h_this->checked_exceptions_start(); // recompute on each iteration, not gc safe
Klass* k = h_this->constants()->klass_at(table[i].class_cp_index, CHECK_(objArrayHandle()));
assert(k->is_subclass_of(SystemDictionary::Throwable_klass()), "invalid exception class");
if (log_is_enabled(Warning, exceptions) &&
!k->is_subclass_of(SystemDictionary::Throwable_klass())) {
ResourceMark rm(THREAD);
log_warning(exceptions)(
"Class %s in throws clause of method %s is not a subtype of class java.lang.Throwable",
k->external_name(), method->external_name());
}
mirrors->obj_at_put(i, k->java_mirror());
}
return mirrors;