RFR: 8338471: Refactor Method::get_new_method() for better NoSuchMethodError handling [v4]

David Holmes dholmes at openjdk.org
Tue Sep 17 08:48:07 UTC 2024


On Wed, 11 Sep 2024 21:02:41 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.
>
> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Coleen suggestion

Note I was responding to Coleen's suggested change to add a fatal() which would be a change in behaviour - though it is unclear to me if the fatal() would replace a crash. It just seems that it is unclear when a caller can never encounter a null or deleted method and so is guaranteed not to get the NMSE throwing "method". IIUC correctly with the current code the caller decides what is possible and employs the NMSE as needed. But the new code internalises the NMSE and then you have to reason that some callers (who appear not to be prepared for it) will in fact never get it. That doesn't seem to be an overall improvement to me - sorry.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20874#issuecomment-2354913061


More information about the serviceability-dev mailing list