On Mon, 10 Aug 2026 09:04:42 GMT, Timofei <[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).
>
> Timofei has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - Add regression test for FollowReferences
>  - Delete unreachable code

Okey, so, delete the tests and add an assert. Also update the description.

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

PR Comment: https://git.openjdk.org/jdk/pull/32253#issuecomment-5291038509

Reply via email to