Buggy code:
public class ToolBar extends Composite { int lastFocusId ; int lastArrowId ; int lastHotId ; ToolItem [ ] items ; ToolItem [ ] tabItemList ; boolean ignoreResize ; boolean ignoreMouse ; ImageList imageList ; ImageList disabledImageList ; ImageList hotImageList ; static final int ToolBarProc ; static final TCHAR ToolBarClass = new TCHAR ( 0 , OS . TOOLBARCLASSNAME , true ) ; static final int DEFAULT_WIDTH = 24 ; static final int DEFAULT_HEIGHT = 22 ; public ToolBar ( Composite parent , int style ) { } int callWindowProc ( int hwnd , int msg , int wParam , int lParam ) { } static int checkStyle ( int style ) { } void checkBuffered ( ) { } protected void checkSubclass ( ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } public Rectangle computeTrim ( int x , int y , int width , int height ) { } Widget computeTabGroup ( ) { ToolItem [ ] items = _getItems ( ) ; if ( ( tabItemList ) == null ) { int i = 0 ; while ( ( i < ( items . length ) ) && ( ( items [ i ] . control ) == null ) ) i ++ ; if ( i == ( items . length ) ) return super . computeTabGroup ( ) ; } int index = ( ( int ) ( OS . SendMessage ( handle , TB_GETHOTITEM , 0 , 0 ) ) ) ; if ( index == ( - 1 ) ) index = lastHotId ; while ( index >= 0 ) { <START_BUG> ToolItem item = getItem ( index ) ; <END_BUG> if ( item . isTabGroup ( ) ) return item ; index -- ; } return super . computeTabGroup ( ) ; } Widget [ ] computeTabList ( ) { } void createHandle ( ) { } void createItem ( ToolItem item , int index ) { } void createWidget ( ) { } int defaultBackground ( ) { } void destroyItem ( ToolItem item ) { } void enableWidget ( boolean enabled ) { } ImageList getDisabledImageList ( ) { } ImageList getHotImageList ( ) { } ImageList getImageList ( ) { } public ToolItem getItem ( int index ) { } public ToolItem getItem ( Point point ) { } public int getItemCount ( ) { } public ToolItem [ ] getItems ( ) { } ToolItem [ ] _getItems ( ) { } public int getRowCount ( ) { } ToolItem [ ] _getTabItemList ( ) { } public int indexOf ( ToolItem item ) { } void layoutItems ( ) { } boolean mnemonicHit ( char ch ) { } boolean mnemonicMatch ( char ch ) { } void releaseChildren ( boolean destroy ) { } void releaseWidget ( ) { } void removeControl ( Control control ) { } void setBackgroundImage ( int hBitmap ) { } void setBackgroundPixel ( int pixel ) { } void setBackgroundTransparent ( boolean transparent ) { } void setBounds ( int x , int y , int width , int height , int flags ) { } void setDefaultFont ( ) { } void setDropDownItems ( boolean set ) { } void setDisabledImageList ( ImageList imageList ) { } public void setFont ( Font font ) { } void setHotImageList ( ImageList imageList ) { } void setImageList ( ImageList imageList ) { } public boolean setParent ( Composite parent ) { } public void setRedraw ( boolean redraw ) { } void setRowCount ( int count ) { } void setTabItemList ( ToolItem [ ] tabList ) { } boolean setTabItemFocus ( ) { } String toolTipText ( NMTTDISPINFO hdr ) { } int widgetStyle ( ) { } TCHAR windowClass ( ) { } int windowProc ( ) { } LRESULT WM_CAPTURECHANGED ( int wParam , int lParam ) { } LRESULT WM_CHAR ( int wParam , int lParam ) { } LRESULT WM_COMMAND ( int wParam , int lParam ) { } LRESULT WM_ERASEBKGND ( int wParam , int lParam ) { } LRESULT WM_GETDLGCODE ( int wParam , int lParam ) { } LRESULT WM_KEYDOWN ( int wParam , int lParam ) { } LRESULT WM_KILLFOCUS ( int wParam , int lParam ) { } LRESULT WM_LBUTTONDOWN ( int wParam , int lParam ) { } LRESULT WM_LBUTTONUP ( int wParam , int lParam ) { } LRESULT WM_MOUSELEAVE ( int wParam , int lParam ) { } LRESULT WM_MOUSEMOVE ( int wParam , int lParam ) { } LRESULT WM_NOTIFY ( int wParam , int lParam ) { } LRESULT WM_SETFOCUS ( int wParam , int lParam ) { } LRESULT WM_SIZE ( int wParam , int lParam ) { } LRESULT WM_WINDOWPOSCHANGING ( int wParam , int lParam ) { } LRESULT wmCommandChild ( int wParam , int lParam ) { } LRESULT wmNotifyChild ( NMHDR hdr , int wParam , int lParam ) { } }

Fix:
ToolItem item = items [ index ] ;