Buggy code:
public class Accessible { static NSString [ ] baseAttributes = new NSString [ ] { OS . NSAccessibilityRoleAttribute , OS . NSAccessibilityRoleDescriptionAttribute , OS . NSAccessibilityHelpAttribute , OS . NSAccessibilityFocusedAttribute , OS . NSAccessibilityParentAttribute , OS . NSAccessibilityChildrenAttribute , OS . NSAccessibilityPositionAttribute , OS . NSAccessibilitySizeAttribute , OS . NSAccessibilityWindowAttribute , OS . NSAccessibilityTopLevelUIElementAttribute } ; static NSString [ ] baseTextAttributes = new NSString [ ] { OS . NSAccessibilityNumberOfCharactersAttribute , OS . NSAccessibilitySelectedTextAttribute , OS . NSAccessibilitySelectedTextRangeAttribute , OS . NSAccessibilityInsertionPointLineNumberAttribute , OS . NSAccessibilitySelectedTextRangesAttribute , OS . NSAccessibilityVisibleCharacterRangeAttribute , OS . NSAccessibilityValueAttribute } ; static NSString [ ] baseParameterizedAttributes = new NSString [ ] { OS . NSAccessibilityStringForRangeParameterizedAttribute , OS . NSAccessibilityRangeForLineParameterizedAttribute } ; NSMutableArray attributeNames = null ; NSMutableArray parameterizedAttributeNames = null ; NSMutableArray actionNames = null ; Vector accessibleListeners = new Vector ( ) ; Vector accessibleControlListeners = new Vector ( ) ; Vector accessibleTextListeners = new Vector ( ) ; Control control ; Map children = new HashMap ( ) ; protected Accessible ( ) { } Accessible ( Control control ) { } public static Accessible internal_new_Accessible ( Control control ) { } public void addAccessibleListener ( AccessibleListener listener ) { } public void addAccessibleControlListener ( AccessibleControlListener listener ) { } public void addAccessibleTextListener ( AccessibleTextListener listener ) { } public id internal_accessibilityActionDescription ( NSString action , int childID ) { } public NSArray internal_accessibilityActionNames ( int childID ) { } public NSArray internal_accessibilityAttributeNames ( int childID ) { } public id internal_accessibilityAttributeValue ( NSString attribute , int childID ) { } public id internal_accessibilityAttributeValue_forParameter ( NSString attribute , id parameter , int childID ) { } public id internal_accessibilityFocusedUIElement ( int childID ) { } public id internal_accessibilityHitTest ( NSPoint point , int childID ) { } public boolean internal_accessibilityIsIgnored ( int childID ) { } public NSArray internal_accessibilityParameterizedAttributeNames ( int childID ) { } public void internal_accessibilityPerformAction ( NSString action , int childID ) { } public Control getControl ( ) { } public void internal_dispose_Accessible ( ) { } id getExpandedAttribute ( int childID ) { } id getHelpAttribute ( int childID ) { } NSString getRoleAttribute ( int childID ) { } id getSubroleAttribute ( int childID ) { } id getRoleDescriptionAttribute ( int childID ) { } id getTitleAttribute ( int childID ) { } id getValueAttribute ( int childID ) { } id getEnabledAttribute ( int childID ) { } id getFocusedAttribute ( int childID ) { AccessibleControlEvent event = new AccessibleControlEvent ( this ) ; event . childID = ACC . CHILDID_MULTIPLE ; event . accessible = null ; for ( int i = 0 ; i < ( accessibleControlListeners . size ( ) ) ; i ++ ) { AccessibleControlListener listener = ( ( AccessibleControlListener ) ( accessibleControlListeners . elementAt ( i ) ) ) ; listener . getFocus ( event ) ; } if ( ( event . childID ) == ( ACC . CHILDID_SELF ) ) { boolean hasFocus = ( event . childID ) == childID ; return NSNumber . numberWithBool ( hasFocus ) ; } if ( ( event . childID ) == ( ACC . CHILDID_NONE ) ) { return NSNumber . numberWithBool ( false ) ; } if ( ( event . childID ) != ( ACC . CHILDID_MULTIPLE ) ) { return NSNumber . numberWithBool ( ( ( event . childID ) == childID ) ) ; } <START_BUG> boolean hasFocus = ( this . control . view . window ( ) . firstResponder ( ) ) == ( control . view ) ; <END_BUG> return NSNumber . numberWithBool ( hasFocus ) ; } id getParentAttribute ( int childID ) { } id getChildrenAttribute ( int childID ) { } id getTabsAttribute ( int childID ) { } id getWindowAttribute ( int childID ) { } id getTopLevelUIElementAttribute ( int childID ) { } id getPositionAttribute ( int childID ) { } id getSizeAttribute ( int childID ) { } id getDescriptionAttribute ( int childID ) { } id getInsertionPointLineNumberAttribute ( int childID ) { } id getNumberOfCharactersAttribute ( int childID ) { } id getRangeForLineParameterizedAttribute ( id parameter , int childID ) { } id getSelectedTextAttribute ( int childID ) { } id getSelectedTextRangeAttribute ( int childID ) { } id getStringForRangeAttribute ( id parameter , int childID ) { } id getSelectedTextRangesAttribute ( int childID ) { } id getVisibleCharacterRangeAttribute ( int childID ) { } int lineNumberForOffset ( String text , int offset ) { } NSRange rangeForLineNumber ( int lineNumber , String text ) { } public void removeAccessibleListener ( AccessibleListener listener ) { } public void removeAccessibleControlListener ( AccessibleControlListener listener ) { } public void removeAccessibleTextListener ( AccessibleTextListener listener ) { } static NSArray retainedAutoreleased ( NSArray inObject ) { } public void selectionChanged ( ) { } public void setFocus ( int childID ) { } public void textCaretMoved ( int index ) { } public void textChanged ( int type , int startIndex , int length ) { } public void textSelectionChanged ( ) { } id childIDToOs ( int childID ) { } NSString concatStringsAsRole ( NSString str1 , NSString str2 ) { } String roleToOs ( int role ) { } int osToRole ( NSString osRole ) { } void checkWidget ( ) { } boolean isValidThread ( ) { } }

Fix:
boolean hasFocus = control . isFocusControl ( ) ;