Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8263430

Uninitialized Method* variables after JDK-8233913

XMLWordPrintable

    • b14

        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 that replaced `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.

              shade Aleksey Shipilev
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: