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

Ioi Lam iklam at openjdk.org
Wed Sep 10 22:54:44 UTC 2025


On Wed, 10 Sep 2025 10:18:45 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits:
>> 
>>  - Merge branch 'master' into 8367142-simplify-java-mirror-handling-in-jni-methods
>>  - @dholmes-ora comments - remove class_to_verify_considering_redefinition() changes, to be done in separate PR
>>  - more fixes
>>  - tmp: Clean up java mirror handling in JNI methods
>
> src/hotspot/share/prims/jvm.cpp line 912:
> 
>> 910:   // Lookup class must not be a primitive class (whose mirror null Klass*)
>> 911:   if (lookup_k == nullptr) {
>> 912:     THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), "Lookup class is primitive");
> 
> This is a behavioural change.

I reverted the change to the error message.

I don't know how we will ever get a primitive class in there and who would be reading the error message. I added a comment saying the error message is wrong, so people reading this code will not get confused.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27158#discussion_r2338076531


More information about the serviceability-dev mailing list