Integrated: 8274670: Improve version string handling in SA

Yasumasa Suenaga ysuenaga at openjdk.java.net
Wed Oct 6 00:40:11 UTC 2021


On Sun, 3 Oct 2021 13:08:58 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

> Use [java.lang.Runtime.Version](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Runtime.Version.html) 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](https://openjdk.java.net/jeps/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.

This pull request has now been integrated.

Changeset: 986ee5d0
Author:    Yasumasa Suenaga <ysuenaga at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/986ee5d0bfd407dc1b7ce75c7c94b6585bfb497d
Stats:     15 lines in 2 files changed: 1 ins; 1 del; 13 mod

8274670: Improve version string handling in SA

Reviewed-by: cjplummer, sspitsyn

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

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


More information about the serviceability-dev mailing list