Buggy code:
public boolean getVisible ( ) { } int getVisibleRegion ( int control , boolean clipChildren ) { } boolean hasBorder ( ) { } boolean hasFocus ( ) { } int helpProc ( int inControl , int inGlobalMouse , int inRequest , int outContentProvided , int ioHelpContent ) { } void hookEvents ( ) { } public int internal_new_GC ( GCData data ) { } public void internal_dispose_GC ( int context , GCData data ) { } void invalidateChildrenVisibleRegion ( int control ) { } void invalidateVisibleRegion ( int control ) { } void invalWindowRgn ( int window , int rgn ) { } public boolean isEnabled ( ) { } boolean isEnabledCursor ( ) { } boolean isEnabledModal ( ) { } boolean isFocusAncestor ( Control control ) { } public boolean isFocusControl ( ) { } public boolean isReparentable ( ) { } boolean isShowing ( ) { } boolean isTabGroup ( ) { } boolean isTabItem ( ) { } public boolean isVisible ( ) { } Decorations menuShell ( ) { } int kEventAccessibleGetChildAtPoint ( int nextHandler , int theEvent , int userData ) { } int kEventAccessibleGetFocusedChild ( int nextHandler , int theEvent , int userData ) { } int kEventAccessibleGetAllAttributeNames ( int nextHandler , int theEvent , int userData ) { } int kEventAccessibleGetNamedAttribute ( int nextHandler , int theEvent , int userData ) { } int kEventControlContextualMenuClick ( int nextHandler , int theEvent , int userData ) { } int kEventControlGetClickActivation ( int nextHandler , int theEvent , int userData ) { } int kEventControlGetPartRegion ( int nextHandler , int theEvent , int userData ) { } int kEventControlHitTest ( int nextHandler , int theEvent , int userData ) { } int kEventControlSetCursor ( int nextHandler , int theEvent , int userData ) { } int kEventControlSetFocusPart ( int nextHandler , int theEvent , int userData ) { } int kEventControlTrack ( int nextHandler , int theEvent , int userData ) { } int kEventMouseDown ( int nextHandler , int theEvent , int userData ) { } int kEventMouseDragged ( int nextHandler , int theEvent , int userData ) { } int kEventMouseMoved ( int nextHandler , int theEvent , int userData ) { } int kEventMouseUp ( int nextHandler , int theEvent , int userData ) { } int kEventMouseWheelMoved ( int nextHandler , int theEvent , int userData ) { if ( ( ( state ) & ( IGNORE_WHEEL ) ) != 0 ) return OS . eventNotHandledErr ; int window = OS . GetControlOwner ( handle ) ; if ( OS . HIWindowIsDocumentModalTarget ( window , null ) ) { return OS . noErr ; } int [ ] event = new int [ 1 ] ; OS . CreateEvent ( 0 , kEventClassWindow , kEventWindowGetClickModality , 0.0 , 0 , event ) ; if ( ( event [ 0 ] ) != 0 ) { short [ ] part = new short [ 1 ] ; OS . GetEventParameter ( theEvent , kEventParamWindowPartCode , typeWindowPartCode , null , 2 , null , part ) ; int [ ] modifiers = new int [ 1 ] ; OS . GetEventParameter ( theEvent , kEventParamKeyModifiers , typeUInt32 , null , ( ( modifiers . length ) * 4 ) , null , modifiers ) ; OS . SetEventParameter ( event [ 0 ] , kEventParamDirectObject , typeWindowRef , 4 , new int [ ] { window } ) ; OS . SetEventParameter ( event [ 0 ] , kEventParamWindowPartCode , typeWindowPartCode , 2 , part ) ; OS . SetEventParameter ( event [ 0 ] , kEventParamKeyModifiers , typeUInt32 , 4 , modifiers ) ; OS . SetEventParameter ( event [ 0 ] , kEventParamEventRef , typeEventRef , 4 , new int [ ] { theEvent } ) ; OS . SendEventToEventTarget ( event [ 0 ] , OS . GetApplicationEventTarget ( ) ) ; int [ ] clickResult = new int [ 1 ] ; <START_BUG> OS . GetEventParameter ( event [ 0 ] , kEventParamModalClickResult , typeModalClickResult , null , ( ( modifiers . length ) * 4 ) , null , clickResult ) ; <END_BUG> OS . ReleaseEvent ( event [ 0 ] ) ; if ( ( ( clickResult [ 0 ] ) & ( OS . kHIModalClickIsModal ) ) != 0 ) { if ( ( ( clickResult [ 0 ] ) & ( OS . kHIModalClickAllowEvent ) ) == 0 ) { return OS . noErr ; } } } short [ ] wheelAxis = new short [ 1 ] ; OS . GetEventParameter ( theEvent , kEventParamMouseWheelAxis , typeMouseWheelAxis , null , 2 , null , wheelAxis ) ; int [ ] wheelDelta = new int [ 1 ] ; OS . GetEventParameter ( theEvent , kEventParamMouseWheelDelta , typeSInt32 , null , 4 , null , wheelDelta ) ; Shell shell = getShell ( ) ; Control control = this ; while ( control != null ) { if ( ! ( control . sendMouseEvent ( MouseWheel , ( ( short ) ( 0 ) ) , wheelDelta [ 0 ] , SCROLL_LINE , true , theEvent ) ) ) { break ; } if ( control . sendMouseWheel ( wheelAxis [ 0 ] , wheelDelta [ 0 ] ) ) break ; if ( control == ( this ) ) { state |= IGNORE_WHEEL ; int result = OS . CallNextEventHandler ( nextHandler , theEvent ) ; state &= ~ ( IGNORE_WHEEL ) ; if ( result == ( OS . noErr ) ) break ; } if ( control == shell ) break ; control = control . parent ; } return OS . noErr ; } int kEventTextInputUnicodeForKeyEvent ( int nextHandler , int theEvent , int userData ) { } int kEventUnicodeKeyPressed ( int nextHandler , int theEvent , int userData ) { } void markLayout ( boolean changed , boolean all ) { }

Fix:
OS . GetEventParameter ( event [ 0 ] , kEventParamModalClickResult , typeModalClickResult , null , 4 , null , clickResult ) ;