RFR: 8369734: JvmtiExport::post_class_file_load_hook return value is never used

David Holmes dholmes at openjdk.org
Tue Oct 14 05:40:01 UTC 2025


On Mon, 13 Oct 2025 22:26:42 GMT, Francesco Andreuzzi <fandreuzzi at openjdk.org> wrote:

> `JvmtiExport::post_class_file_load_hook` returns a boolean, which tells whether the hook modified the class data or not. Users of the function write the same check on their own. I propose replacing the handwritten check with the boolean returned by `post_class_file_load_hook`.
> 
> Passes tier1 and tier2 (fastdebug).

Sorry for ping-ponging on the serviceability labeling. I'm not sure this is the right fix. The logic to return a value from `post_class_file_load_hook` was added way back in JDK 9 by [JDK-8171008](https://bugs.openjdk.org/browse/JDK-8171008) as part of the original AOT compiler effort. But at that time no changes were made to any of the callers to use the new return value! That means this aspect of the code is completely untested - and it is also completely undocumented.

I'd be more inclined to treat the `has_been_modified` aspect of `JvmtiClassFileLoadHookPoster` as dead code and remove it again. But we need serviceability folk to make that call - @plummercj or @sspitsyn ?

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

PR Comment: https://git.openjdk.org/jdk/pull/27777#issuecomment-3400196178


More information about the serviceability-dev mailing list