RFR: 8367142: Avoid InstanceKlass::cast when converting java mirror to InstanceKlass [v3]
Stefan Karlsson
stefank at openjdk.org
Thu Sep 11 06:47:16 UTC 2025
On Wed, 10 Sep 2025 22:47:27 GMT, Ioi Lam <iklam at openjdk.org> wrote:
> I didn't realize that my attempt to remove the JNIHandles::resolve() boilerplate can be conversional.
Removing boilerplate wasn't controversial. Spreading the j* types can be seen as controversial give that we have various efforts to push those types out to the boundaries of the JVM. Adding new convenience functions that accept j* goes in the opposite direction.
> I can't put a helper function in jni.cpp because this pattern is used in several files.
But almost all are in jni.cpp and jvm.cpp and you can get rid of most of the boilerplate code by adding local helpers there. The handfulish of other places could keep their explicit usage of JNIHandles::resolve* calls.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27158#issuecomment-3278518160
More information about the serviceability-dev
mailing list