Buggy code:
public void syncExec ( Runnable runnable ) { } public void timerExec ( int milliseconds , Runnable runnable ) { } int timerProc ( int id ) { } public void update ( ) { } public void wake ( ) { } void wakeThread ( ) { } Control findControl ( NSEvent nsEvent ) { } int applicationNextEventMatchingMask ( int id , int sel , int mask , int expiration , int mode , int dequeue ) { } void applicationSendMouseEvent ( NSEvent nsEvent , boolean send ) { } void applicationSendEvent ( int id , int sel , int event ) { } int applicationProc ( int id , int sel , int event ) { } int applicationProc ( int id , int sel , int arg0 , int arg1 , int arg2 , int arg3 ) { } int applicationDelegateProc ( int id , int sel , int arg0 ) { } int dialogProc ( int id , int sel , int arg0 ) { } int windowDelegateProc ( int id , int sel ) { } int windowDelegateProc ( int id , int sel , int arg0 ) { if ( sel == ( OS . sel_timerProc_1 ) ) { return timerProc ( arg0 ) ; } Widget widget = getWidget ( id ) ; if ( widget == null ) return 0 ; if ( sel == ( OS . sel_windowWillClose_1 ) ) { widget . windowWillClose ( arg0 ) ; } else if ( sel == ( OS . sel_drawRect_1 ) ) { NSRect rect = new NSRect ( ) ; OS . memmove ( rect , arg0 , sizeof ) ; widget . drawRect ( id , rect ) ; } else if ( sel == ( OS . sel_setFrameOrigin_1 ) ) { NSPoint point = new NSPoint ( ) ; OS . memmove ( point , arg0 , NSPoint . sizeof ) ; widget . setFrameOrigin ( id , sel , point ) ; } else if ( sel == ( OS . sel_setFrameSize_1 ) ) { NSSize size = new NSSize ( ) ; OS . memmove ( size , arg0 , NSSize . sizeof ) ; widget . setFrameSize ( id , sel , size ) ; } else if ( sel == ( OS . sel_hitTest_1 ) ) { NSPoint point = new NSPoint ( ) ; OS . memmove ( point , arg0 , NSPoint . sizeof ) ; return widget . hitTest ( id , sel , point ) ; } else if ( sel == ( OS . sel_windowShouldClose_1 ) ) { return widget . windowShouldClose ( arg0 ) ? 1 : 0 ; } else if ( sel == ( OS . sel_mouseDown_1 ) ) { widget . mouseDown ( id , sel , arg0 ) ; } else if ( sel == ( OS . sel_mouseUp_1 ) ) { widget . mouseUp ( id , sel , arg0 ) ; } else if ( sel == ( OS . sel_rightMouseDown_1 ) ) { widget . rightMouseDown ( id , sel , arg0 ) ; } else if ( sel == ( OS . sel_rightMouseUp_1 ) ) { widget . rightMouseUp ( id , sel , arg0 ) ; } else if ( sel == ( OS . sel_otherMouseDown_1 ) ) { widget . otherMouseDown ( id , sel , arg0 ) ; } else if ( sel == ( OS . sel_otherMouseUp_1 ) ) { widget . otherMouseUp ( id , sel , arg0 ) ; } else if ( sel == ( OS . sel_mouseMoved_1 ) ) { widget . mouseMoved ( id , sel , arg0 ) ; } else if ( sel == ( OS . sel_mouseDragged_1 ) ) { widget . mouseDragged ( id , sel , arg0 ) ; } else if ( sel == ( OS . sel_mouseEntered_1 ) ) { widget . mouseEntered ( id , sel , arg0 ) ; } else if ( sel == ( OS . sel_mouseExited_1 ) ) { widget . mouseExited ( id , sel , arg0 ) ; } else if ( sel == ( OS . sel_menuForEvent_1 ) ) { <START_BUG> return widget . menuForEvent ( id , sel , arg0 ) ; <END_BUG> } else if ( sel == ( OS . sel_flagsChanged_1 ) ) { widget . flagsChanged ( arg0 ) ; } else if ( sel == ( OS . sel_numberOfRowsInTableView_1 ) ) { return widget . numberOfRowsInTableView ( arg0 ) ; } else if ( sel == ( OS . sel_comboBoxSelectionDidChange_1 ) ) { widget . comboBoxSelectionDidChange ( arg0 ) ; } else if ( sel == ( OS . sel_tableViewSelectionDidChange_1 ) ) { widget . tableViewSelectionDidChange ( arg0 ) ; } else if ( sel == ( OS . sel_windowDidResignKey_1 ) ) { widget . windowDidResignKey ( arg0 ) ; } else if ( sel == ( OS . sel_windowDidBecomeKey_1 ) ) { widget . windowDidBecomeKey ( arg0 ) ; } else if ( sel == ( OS . sel_windowDidResize_1 ) ) { widget . windowDidResize ( arg0 ) ; } else if ( sel == ( OS . sel_windowDidMove_1 ) ) { widget . windowDidMove ( arg0 ) ; } else if ( sel == ( OS . sel_menuWillOpen_1 ) ) { widget . menuWillOpen ( arg0 ) ; } else if ( sel == ( OS . sel_menuWillClose_1 ) ) { widget . menuWillClose ( arg0 ) ; } else if ( sel == ( OS . sel_menuNeedsUpdate_1 ) ) { widget . menuNeedsUpdate ( arg0 ) ; } else if ( sel == ( OS . sel_outlineViewSelectionDidChange_1 ) ) { widget . outlineViewSelectionDidChange ( arg0 ) ; } else if ( sel == ( OS . sel_sendEvent_1 ) ) { widget . windowSendEvent ( id , arg0 ) ; } else if ( sel == ( OS . sel_helpRequested_1 ) ) { widget . helpRequested ( arg0 ) ; }

Fix:
return widget . menuForEvent ( id ) ;