Integrated: 8263430: Uninitialized Method* variables after JDK-8233913

Aleksey Shipilev shade at openjdk.java.net
Fri Mar 12 07:44:07 UTC 2021


On Thu, 11 Mar 2021 09:43:52 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> SonarCloud instance reports problems like:
>  The left operand of '==' is a garbage value
> 
> C2V_VMENTRY_NULL(jobject, getResolvedJavaMethod, (JNIEnv* env, jobject, jobject base, jlong offset))
>   Method* method;
>  ...
>   if (method == NULL) { // <--- here
>     JVMCI_THROW_MSG_NULL(IllegalArgumentException, err_msg("Unexpected type: %s", JVMCIENV->klass_name(base_object)));
>   }
> 
> I believe this is caused by refactoring in [JDK-8233913](https://bugs.openjdk.java.net/browse/JDK-8233913) that [replaced](https://hg.openjdk.java.net/jdk/jdk/rev/15936b142f86#l39.38) `methodHandle` with naked `Method*`. `methodHandle` is implicitly initialized to null, while naked variable is not. After reading the original changeset, I found two other places where the same thing happens.

This pull request has now been integrated.

Changeset: e25ad730
Author:    Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/e25ad730
Stats:     3 lines in 3 files changed: 0 ins; 0 del; 3 mod

8263430: Uninitialized Method* variables after JDK-8233913

Reviewed-by: coleenp, hseigel

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

PR: https://git.openjdk.java.net/jdk/pull/2936


More information about the hotspot-dev mailing list