JDK-8242174 : [macos] The NestedModelessDialogTest test make the macOS unstable
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 11,14,15
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2020-04-06
  • Updated: 2022-01-20
  • Resolved: 2020-04-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 15
11.0.8-oracleFixed 13.0.4Fixed 15 b21Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
This test use robot like this:
        robot.keyPress(KeyEvent.VK_SHIFT);
        robot.keyPress(KeyEvent.VK_H);
        robot.waitForIdle();
        robot.keyRelease(KeyEvent.VK_H);
        robot.keyRelease(KeyEvent.VK_SHIFT);

Which sometimes causes the shift button to be in the pressed state after the test is completed, even if the test itself is passed. This break some tests which are executed later.
Comments
Ran NestedModelessDialogTest and it's passing, but couldn't reproduce the issue without fix, so closing it as not verified.
21-07-2020

Fix request (13u) Requesting backport to 13u for parity with 11u, applies cleanly.
09-06-2020

jdk11 backport request I would like to have the patch in OpenJDK11 as well (for better parity with 11.0.8_oracle). The patch needs slight adjustment in ProblemList.txt , RFR : https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-May/003065.html .
04-05-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/d5d7e0df08d2 User: psadhukhan Date: 2020-04-24 11:16:29 +0000
24-04-2020

URL: https://hg.openjdk.java.net/jdk/client/rev/d5d7e0df08d2 User: serb Date: 2020-04-20 16:38:25 +0000
20-04-2020

Looks like a few tests for menu mnemonics started to fail intermittently after this fix, so Sergey will double-check the root cause.
16-04-2020

The similar discussion about how to properly set modifiers across different key events: https://stackoverflow.com/questions/2008126/cgeventpost-possible-bug-when-simulating-keyboard-events/4137273#4137273
13-04-2020

Response from Apple: ======================= Engineering has the following feedback for you: It’s possible, but you have to post and give time for the event source to update to match state. Try put some delays between each CGEventPost. ...and the creation of subsequent events needs to be after those postings - the events inherit their flags at creation time. =======================
06-04-2020

The bug reported to Apple: =============== FB5415543: It is not possible to emulate human behaviour using CGEventPost and CGEventCreateKeyboardEvent 47839781 - It is not possible to emulate the next sequence of press/release(shift+z): CGEventRef event1, event2, event3, event4; event1 = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)56, true); event2 = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)6, true); event3 = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)6, false); event4 = CGEventCreateKeyboardEvent (NULL, (CGKeyCode)56, false); CGEventPost(kCGHIDEventTap, event1); CGEventPost(kCGHIDEventTap, event2); CGEventPost(kCGHIDEventTap, event3); CGEventPost(kCGHIDEventTap, event4); It will type the lowcase "z" instead of uppercase "Z", as specified in the documentation: https://developer.apple.com/documentation/coregraphics/1456564-cgeventcreatekeyboardevent?language=objc Same bug was found in "Xamarin": https://forums.xamarin.com/discussion/126313/simulate-sending-modifier-key-in-macos
06-04-2020