RFR: 8367142: Avoid InstanceKlass::cast when converting java mirror to InstanceKlass [v3]

Ioi Lam iklam at openjdk.org
Thu Sep 11 18:34:06 UTC 2025


On Thu, 11 Sep 2025 06:44:51 GMT, Stefan Karlsson <stefank 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.

Maybe in a different PR. I want to keep the current PR simple.

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

PR Comment: https://git.openjdk.org/jdk/pull/27158#issuecomment-3282181436


More information about the serviceability-dev mailing list