RFR: 8369021: A crash in ConstantPool::klass_at_impl
David Holmes
dholmes at openjdk.org
Fri Oct 3 11:48:46 UTC 2025
On Thu, 2 Oct 2025 18:19:20 GMT, Jan Kratochvil <jkratochvil at openjdk.org> wrote:
>> src/hotspot/share/prims/jvm.cpp line 1335:
>>
>>> 1333:
>>> 1334: bool inner_is_member = false;
>>> 1335: Klass* outer_klass = k->compute_enclosing_class(&inner_is_member, CHECK_NULL);
>>
>> Why not put this change in compute_enclosing_class() instead?
>
> Various other similar methods such as:
> - JVM_GetClassDeclaredFields
> - JVM_GetClassDeclaredMethods
> - JVM_GetClassDeclaredConstructors
>
> already contain the same code fragment:
>
> // Ensure class is linked
> k->link_class(CHECK_NULL);
>
> so without some deep thoughts I have added it also to this method where it was missing and causing a crash:
> - JVM_GetDeclaringClass
>
> Without any real world proof it looked to me the similar pattern is also in:
> - JVM_GetSimpleBinaryName
>
> I can move it to `InstanceKlass::compute_enclosing_class` although first I would like to find a reproducer = test case.
Various reflection methods have to work on a linked class, but that doesn't mean they all have to. I'm not convinced the true problem has been identified here yet.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27595#discussion_r2401619726
More information about the hotspot-dev
mailing list