Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8274840: Update OS detection code to recognize Windows 11
Co-authored-by: Arno Zeller <arno.zeller@sap.com>
Reviewed-by: clanger, dholmes
  • Loading branch information
MBaesken and ArnoZeller committed Oct 8, 2021
1 parent 8de7763 commit 97ea9dd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/hotspot/os/windows/os_windows.cpp
Expand Up @@ -1858,7 +1858,11 @@ void os::win32::print_windows_version(outputStream* st) {

case 10000:
if (is_workstation) {
st->print("10");
if (build_number >= 22000) {
st->print("11");
} else {
st->print("10");
}
} else {
// distinguish Windows Server by build number
// - 2016 GA 10/2016 build: 14393
Expand Down
11 changes: 10 additions & 1 deletion src/java.base/windows/native/libjava/java_props_md.c
Expand Up @@ -471,6 +471,8 @@ GetJavaProperties(JNIEnv* env)
* Windows Server 2012 6 2 (!VER_NT_WORKSTATION)
* Windows Server 2012 R2 6 3 (!VER_NT_WORKSTATION)
* Windows 10 10 0 (VER_NT_WORKSTATION)
* Windows 11 10 0 (VER_NT_WORKSTATION)
* where (buildNumber >= 22000)
* Windows Server 2016 10 0 (!VER_NT_WORKSTATION)
* Windows Server 2019 10 0 (!VER_NT_WORKSTATION)
* where (buildNumber > 17762)
Expand Down Expand Up @@ -544,7 +546,14 @@ GetJavaProperties(JNIEnv* env)
} else if (majorVersion == 10) {
if (is_workstation) {
switch (minorVersion) {
case 0: sprops.os_name = "Windows 10"; break;
case 0:
/* Windows 11 21H2 (original release) build number is 22000 */
if (buildNumber >= 22000) {
sprops.os_name = "Windows 11";
} else {
sprops.os_name = "Windows 10";
}
break;
default: sprops.os_name = "Windows NT (unknown)";
}
} else {
Expand Down

9 comments on commit 97ea9dd

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@TheRealMDoerr
Copy link
Contributor

Choose a reason for hiding this comment

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

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 97ea9dd Oct 13, 2021

Choose a reason for hiding this comment

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

@TheRealMDoerr @TheRealMDoerr the backport was successfully created on the branch TheRealMDoerr-backport-97ea9dd2 in my personal fork of openjdk/jdk11u-dev. To create a pull request with this backport targeting openjdk/jdk11u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit 97ea9dd2 from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 8 Oct 2021 and was reviewed by Christoph Langer and David Holmes.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk11u-dev:

$ git fetch https://github.com/openjdk-bots/jdk11u-dev TheRealMDoerr-backport-97ea9dd2:TheRealMDoerr-backport-97ea9dd2
$ git checkout TheRealMDoerr-backport-97ea9dd2
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk11u-dev TheRealMDoerr-backport-97ea9dd2

@durgeshpatidar
Copy link

@durgeshpatidar durgeshpatidar commented on 97ea9dd Jun 20, 2022

Choose a reason for hiding this comment

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

@MBaesken @TheRealMDoerr Can you please backport/commit this same solution on latest version of open JDK 8.

@TheRealMDoerr
Copy link
Contributor

Choose a reason for hiding this comment

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

@MBaesken @TheRealMDoerr Can you please backport/commit this same solution on latest version of oepn jdk 8.

We only maintain 11u and 17u. Please ask one of the 8u maintainers or create an own backport PR.
See https://wiki.openjdk.org/display/jdk8u/Main

@durgeshpatidar
Copy link

Choose a reason for hiding this comment

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

@TheRealMDoerr Sorry, but I do not have access to create any issue/PR. I'm user of openjdk, not an employee.
And don't know any person except you.
Can you please create it or ask it to someone who are working in 8u.
Thanks in advance.

@TheRealMDoerr
Copy link
Contributor

Choose a reason for hiding this comment

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

@jerboaa @gnu-andrew There's a request to backport it to 8u. Please take a look.

@jerboaa
Copy link
Contributor

Choose a reason for hiding this comment

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

/cc @akashche This could be one for you to look at?

@openjdk
Copy link

@openjdk openjdk bot commented on 97ea9dd Jun 21, 2022

Choose a reason for hiding this comment

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

@jerboaa Unknown command cc - for a list of valid commands use /help.

Please sign in to comment.