|
Duplicate :
|
|
|
Relates :
|
|
|
Relates :
|
The problem described in CR#6195828 is back.
PASSES: JDK7b147, JDK7u2, JDK8b14
FAILS: JDK8 b20 (exact build number when the regression was introduced is unknown)
Platform: was reproduced on Windows
Please see the following minimized testcase:
---
import java.awt.*;
import java.awt.event.KeyEvent;
import java.util.HashSet;
public class SetFocusTraversalKeys {
public static void main(String[] args) {
Component button = new Component() {};
AWTKeyStroke key = AWTKeyStroke.getAWTKeyStrokeForEvent(
new KeyEvent(button, KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_UNDEFINED, 'a'));
HashSet set = new HashSet();
set.add(key);
set.add(new Object());
try {
button.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, set);
} catch(Exception e) {
if (e instanceof IllegalArgumentException) {
System.out.println("Component: OKAY");
} else {
e.printStackTrace();
System.out.println("Component: unexpected " + e + " thrown instead of IAE");
}
}
}
}
---
For 8b20 the ouput is:
java.lang.ClassCastException: java.lang.Object cannot be cast to java.awt.AWTKeyStroke
at java.awt.Component.setFocusTraversalKeys_NoIDCheck(Component.java:7251)
at java.awt.Component.setFocusTraversalKeys(Component.java:7200)
at bugs.SetFocusTraversalKeys.main(SetFocusTraversalKeys.java:19)
Component: unexpected java.lang.ClassCastException: java.lang.Object cannot be cast to java.awt.AWTKeyStroke thrown instead of IAE
The following JCK testcases fails due to this issue:
api/java_awt/awt_focus_subsystem/focus_traversal/index.html#FocusTraversal3[FocusTraversal3_hw_0005]
api/java_awt/awt_focus_subsystem/focus_traversal/index.html#FocusTraversal3[FocusTraversal3_lw_0006]
|