JDK-7125491 : [macosx] Regression: A component can get unexpected keyTyped event.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86
  • Submitted: 2011-12-28
  • Updated: 2012-05-17
  • Resolved: 2012-02-29
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 7
7u4 b11Fixed
Related Reports
Relates :  
Description
Run a regression test java/awt/KeyboardFocusManager/TypeAhead/ButtonActionKeyTest several times. You will see that there always is action performed. In addition, the next text field does receive some parts of this action entourage: always KEY_RELEASED and sometimes KEY_TYPED but never KEY_PRESSED. The arrival of KEY_TYPED is a regression from 6396785.
For me, KEY_TYPED arrives once of four or five times.

Someway reduced test without Robot or synchronization behaves just the same so that's not a Robot issue.

Comments
SUGGESTED FIX http://cr.openjdk.java.net/~ant/7125491/webrev.0/
20-01-2012

EVALUATION Here's what happens: 1. "A" key is pressed on the button. KEY_PRESSED event is posted (natively originated) with some t0 time. KEY_TYPED event is posted (synthesized) with some t1 time. 2. KEY_PRESSED is dispatched to the button, action binding is resolved, focus is requested to the textfield. The focus request is marked with a time stamp corresponding to the most-recent-event-time (most recently dispatched event) which is t0. A type-ahead-marker (t0) is created & pushed. 3. KEY_TYPED is being dispatched. In case t1 > t0, the event is queued until the textfield gains focus and after that is eventually dispatched to the textfield. In case t1 == t0, the event is dispatched to the button (expected behaviour). So, the problem is that t1 and t0 times may differ. However, KEY_PRESSED & KEY_TYPED java events are actually a production of a single native key down event. So, t1 must equal t0. That's what we have in X11 code, where KEY_TYPED is also synthesized (not natively originated).
18-01-2012