Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8273229: Update OS detection code to recognize Windows Server 2022 #5347

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1866,9 +1866,13 @@ void os::win32::print_windows_version(outputStream* st) {
if (is_workstation) {
st->print("10");
} else {
// distinguish Windows Server 2016 and 2019 by build number
// Windows server 2019 GA 10/2018 build number is 17763
if (build_number > 17762) {
// distinguish Windows Server by build number
// - 2016 GA 10/2016 build: 14393
// - 2019 GA 11/2018 build: 17763
// - 2022 GA 08/2021 build: 20348
if (build_number > 20347) {
st->print("Server 2022");
} else if (build_number > 17762) {
st->print("Server 2019");
} else {
st->print("Server 2016");
@@ -389,7 +389,7 @@ GetJavaProperties(JNIEnv* env)
GetVersionEx((OSVERSIONINFO *) &ver);
majorVersion = ver.dwMajorVersion;
minorVersion = ver.dwMinorVersion;
/* distinguish Windows Server 2016 and 2019 by build number */
/* distinguish Windows Server 2016+ by build number */
buildNumber = ver.dwBuildNumber;
is_workstation = (ver.wProductType == VER_NT_WORKSTATION);
platformId = ver.dwPlatformId;
@@ -474,6 +474,8 @@ GetJavaProperties(JNIEnv* env)
* Windows Server 2016 10 0 (!VER_NT_WORKSTATION)
* Windows Server 2019 10 0 (!VER_NT_WORKSTATION)
* where (buildNumber > 17762)
* Windows Server 2022 10 0 (!VER_NT_WORKSTATION)
* where (buildNumber > 20347)
Copy link
Member

@dholmes-ora dholmes-ora Sep 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a comment at line 392 that you may want to adjust too - perhaps just say "Windows Server 2016+" to avoid the need to keep updating it.

*
* This mapping will presumably be augmented as new Windows
* versions are released.
@@ -549,7 +551,10 @@ GetJavaProperties(JNIEnv* env)
switch (minorVersion) {
case 0:
/* Windows server 2019 GA 10/2018 build number is 17763 */
if (buildNumber > 17762) {
/* Windows server 2022 build number is 20348 */
if (buildNumber > 20347) {
sprops.os_name = "Windows Server 2022";
} else if (buildNumber > 17676) {
sprops.os_name = "Windows Server 2019";
} else {
sprops.os_name = "Windows Server 2016";