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 1 commit
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,12 @@ void os::win32::print_windows_version(outputStream* st) {
if (is_workstation) {
st->print("10");
} else {
// distinguish Windows Server 2016 and 2019 by build number
// distinguish Windows Server 2016, 2019 and 2022 by build number
// Windows server 2019 GA 10/2018 build number is 17763
if (build_number > 17762) {
// Windows server 2022 build number is 20348
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.

Perhaps to avoid too much future editing:

// Distinguish Windows Server by build number:
// - 2016 GA 10/2016 build: 14393
// - 2019 GA 11/2018 build: 17763
// - 2022 GA 08/2021 build: 20348

Copy link
Member Author

@MBaesken MBaesken Sep 2, 2021

Choose a reason for hiding this comment

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

Hi David , thanks for your suggestions. I adjusted the comments.

Best regards, Matthias

if (build_number > 20347) {
st->print("Server 2022");
} else if (build_number > 17762) {
st->print("Server 2019");
} else {
st->print("Server 2016");
@@ -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";