RFR: 8369021: A crash in ConstantPool::klass_at_impl

Jan Kratochvil jkratochvil at openjdk.org
Thu Oct 2 18:21:47 UTC 2025


On Wed, 1 Oct 2025 21:53:33 GMT, Dean Long <dlong at openjdk.org> wrote:

>> https://bugs.openjdk.org/browse/JDK-8369021
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27595#discussion_r2399687735


More information about the hotspot-dev mailing list