Buggy code:
public class Composite extends Scrollable { Layout layout ; Control [ ] tabList ; int layoutCount ; int backgroundMode ; Composite ( ) { } public Composite ( Composite parent , int style ) { } Control [ ] _getChildren ( ) { } Control [ ] _getTabList ( ) { } boolean acceptsFirstResponder ( int id , int sel ) { } int accessibilityAttributeNames ( int id , int sel ) { } boolean accessibilityIsIgnored ( int id , int sel ) { } public void changed ( Control [ ] changed ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } protected void checkSubclass ( ) { } Widget [ ] computeTabList ( ) { } void createHandle ( ) { } void drawBackground ( int id , NSGraphicsContext context , NSRect rect ) { } Composite findDeferredControl ( ) { } Menu [ ] findMenus ( Control control ) { } void fixChildren ( Shell newShell , Shell oldShell , Decorations newDecorations , Decorations oldDecorations , Menu [ ] menus ) { } void fixTabList ( Control control ) { } public int getBackgroundMode ( ) { } public Control [ ] getChildren ( ) { } public Layout getLayout ( ) { } public boolean getLayoutDeferred ( ) { } public Control [ ] getTabList ( ) { } boolean hooksKeys ( ) { } void invalidateChildrenVisibleRegion ( ) { } public boolean isLayoutDeferred ( ) { } boolean isOpaque ( int id , int sel ) { } boolean isTabGroup ( ) { } void keyDown ( int id , int sel , int theEvent ) { <START_BUG> if ( ( view . window ( ) . firstResponder ( ) . id ) == id ) { <END_BUG> if ( ( ( state ) & ( CANVAS ) ) != 0 ) { Shell s = this . getShell ( ) ; NSArray array = NSArray . arrayWithObject ( new NSEvent ( theEvent ) ) ; s . keyInputHappened = false ; view . interpretKeyEvents ( array ) ; if ( imeInComposition ( ) ) return ; if ( ! ( s . keyInputHappened ) ) { NSEvent nsEvent = new NSEvent ( theEvent ) ; boolean [ ] consume = new boolean [ 1 ] ; if ( translateTraversal ( nsEvent . keyCode ( ) , nsEvent , consume ) ) return ; if ( isDisposed ( ) ) return ; if ( ! ( sendKeyEvent ( nsEvent , KeyDown ) ) ) return ; if ( consume [ 0 ] ) return ; } return ; } } super . keyDown ( id , sel , theEvent ) ; } public void layout ( ) { } public void layout ( boolean changed ) { } public void layout ( boolean changed , boolean all ) { } public void layout ( Control [ ] changed ) { } void markLayout ( boolean changed , boolean all ) { } Point minimumSize ( int wHint , int Hint , boolean changed ) { } boolean mouseEvent ( int id , int sel , int theEvent , int type ) { } void pageDown ( int id , int sel , int sender ) { } void pageUp ( int id , int sel , int sender ) { } void reflectScrolledClipView ( int id , int sel , int aClipView ) { } void releaseChildren ( boolean destroy ) { } void releaseWidget ( ) { } void removeControl ( Control control ) { } void resized ( ) { } void scrollWheel ( int id , int sel , int theEvent ) { } public void setBackgroundMode ( int mode ) { } public boolean setFocus ( ) { } public void setLayout ( Layout layout ) { } public void setLayoutDeferred ( boolean defer ) { } boolean setScrollBarVisible ( ScrollBar bar , boolean visible ) { } boolean setTabGroupFocus ( ) { } public void setTabList ( Control [ ] tabList ) { } int traversalCode ( int key , NSEvent theEvent ) { } void updateBackgroundMode ( ) { } void updateCursorRects ( boolean enabled ) { } void updateLayout ( boolean all ) { } }

Fix:
if ( hasFocus ( ) ) {