Skip to content

Commit 3757f66

Browse files
Daniel Gredleraivanov-jdk
authored andcommitted
8353002: Remove unnecessary Windows version check in WTaskbarPeer
Reviewed-by: prr, serb, aivanov
1 parent 05ff557 commit 3757f66

File tree

2 files changed

+52
-5
lines changed

2 files changed

+52
-5
lines changed

src/java.desktop/windows/classes/sun/awt/windows/WTaskbarPeer.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@
3434
import java.awt.image.BufferedImage;
3535
import java.awt.image.DataBufferInt;
3636
import sun.awt.AWTAccessor;
37-
import sun.awt.OSInfo;
3837
import sun.awt.shell.ShellFolder;
3938

4039
final class WTaskbarPeer implements TaskbarPeer {
@@ -44,9 +43,7 @@ final class WTaskbarPeer implements TaskbarPeer {
4443

4544
private static synchronized void init() {
4645
if (!initExecuted) {
47-
supported = OSInfo.getWindowsVersion()
48-
.compareTo(OSInfo.WINDOWS_7) >= 0
49-
&& ShellFolder.invoke(() -> nativeInit());
46+
supported = ShellFolder.invoke(() -> nativeInit());
5047
}
5148
initExecuted = true;
5249
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
import java.awt.Taskbar;
25+
import java.awt.Taskbar.Feature;
26+
27+
/*
28+
* @test
29+
* @bug 8353002
30+
* @key headful
31+
* @requires (os.family == "windows")
32+
* @summary Verifies that expected taskbar features are supported on Windows.
33+
*/
34+
35+
public class TaskbarFeatureTest {
36+
37+
public static void main(String[] args) throws Exception {
38+
Taskbar taskbar = Taskbar.getTaskbar();
39+
testFeature(taskbar, Feature.ICON_BADGE_IMAGE_WINDOW);
40+
testFeature(taskbar, Feature.PROGRESS_STATE_WINDOW);
41+
testFeature(taskbar, Feature.PROGRESS_VALUE_WINDOW);
42+
testFeature(taskbar, Feature.USER_ATTENTION_WINDOW);
43+
}
44+
45+
private static void testFeature(Taskbar taskbar, Feature feature) {
46+
if (!taskbar.isSupported(feature)) {
47+
throw new RuntimeException("Feature not supported: " + feature);
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)