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

Improve version string handling in SA

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9, 11, 17, 18
    • Fix Version/s: 18
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Introduced In Version:
      9
    • Resolved In Build:
      b18

      Description

      Use java.lang.Runtime.Version to check the version of debugee.

      Currently `checkVMVersion()` in `sun.jvm.hotspot.runtime.VM` has following code to check the version of debugee.

      ```
              if (saVersion.indexOf('-') == saVersion.lastIndexOf('-') &&
                  vmVersion.indexOf('-') == vmVersion.lastIndexOf('-')) {
                 // Throw exception if different release versions:
                 // <major>.<minor>-b<n>
                 throw new VMVersionMismatchException(saVersion, vmRelease);
              } else {
                 // Otherwise print warning to allow mismatch not release versions
                 // during development.
                 System.err.println("WARNING: Hotspot VM version " + vmRelease +
                                    " does not match with SA version " + saVersion +
                                    "." + " You may see unexpected results. ");
              }
      ```

      It seems to expect to allow the deference in option string only.
      For example, saVersion is "17+35", and vmVersion is "17+35-2724", then it should be allowed because release version (17+35) is same. However current code would not do so.

      I guess this code is not based on JEP 223 (New Version-String Scheme) because the comment says "<major>.<minor>-b<n>". Fortunately we have `Runtime.Version` to handle version strings. We should refactor with it.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ysuenaga Yasumasa Suenaga
              Reporter:
              ysuenaga Yasumasa Suenaga
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: