RFR: 8366488: JVM_FindClassFromClass should assert that from class is never null

David Holmes dholmes at openjdk.org
Tue Oct 28 09:26:08 UTC 2025


On Mon, 27 Oct 2025 13:46:22 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/prims/jvm.cpp line 830:
>> 
>>> 828:   Klass* from_class = (from_class_oop == nullptr)
>>> 829:                            ? (Klass*)nullptr
>>> 830:                            : java_lang_Class::as_Klass(from_class_oop);
>> 
>> Don't you want to get rid of this ?: also?  Assert that from_class_oop != nullptr instead?
>
> Or have both asserts, from_class_oop is non-null and also from_class_oop->_klass is non-null.

Yep Coleen is right. I totally misread the issue - `from` is what is not null, and hence `from_class` cannot be null.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27957#discussion_r2468673706


More information about the hotspot-dev mailing list