RFR: 8338471: Refactor Method::get_new_method() for better NoSuchMethodError handling
Coleen Phillimore
coleenp at openjdk.org
Fri Sep 6 12:55:53 UTC 2024
On Thu, 5 Sep 2024 18:56:19 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:
> This patch cleans up the use of `get_new_method()` so callers don't have to worry about throwing `NoSuchMethodError`. The method is refactored to throw the error and avoid ever returning nullptr. Verified with tier1-5 tests.
We do the same thing with illegal_access_error() where the arguments may not match and there's a special case for this and no_such_method_error() in dependencies. Are the compilers confused by this too?
if (target == nullptr || !target->is_public() || target->is_abstract() || target->is_overpass()) {
assert(target == nullptr || !target->is_overpass() || target->is_public(),
"Non-public overpass method!");
// Entry does not resolve. Leave it empty for AbstractMethodError or other error.
if (!(target == nullptr) && !target->is_public()) {
// Stuff an IllegalAccessError throwing method in there instead.
itableOffsetEntry::method_entry(_klass, method_table_offset)[m->itable_index()].
initialize(_klass, Universe::throw_illegal_access_error());
}
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20874#issuecomment-2333984362
More information about the hotspot-dev
mailing list