On Fri, 7 Aug 2026 11:01:58 GMT, Timofei Fedotov <[email protected]> wrote:

> FollowReferences function has unreachable code. The null check was 
> incorrectly applied to the klass variable inside a block where klass is 
> already guaranteed to be non-null. Because of this, the check was always 
> false, and the extracted internal Klass* pointer (k) was left unchecked, 
> which could lead to a null pointer dereference.
> 
> Since k_mirror is checked for null and primitive types earlier in the 
> function, java_lang_Class::as_Klass(k_mirror) is guaranteed to return a 
> non-null Klass* pointer. Therefore, the typo'd dead code is removed and 
> replaced with an assert to uphold this invariant.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

This pull request has now been integrated.

Changeset: 03530368
Author:    Timofei Fedotov <[email protected]>
Committer: Artem Semenov <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/03530368cc7e2f1e5a15226d081eb495646b01fc
Stats:     3 lines in 1 file changed: 0 ins; 2 del; 1 mod

8389941: JvmtiEnv::FollowReferences has unreachable code in jvmtiEnv.cpp

Reviewed-by: asemenov, dholmes

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

PR: https://git.openjdk.org/jdk/pull/32253

Reply via email to