Buggy code:
void clearAll ( TreeItem parentItem , boolean all ) { } public void clear ( int index , boolean all ) { } public void clearAll ( boolean all ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } void createHandle ( ) { } void createItem ( TreeColumn column , int index ) { } void createItem ( TreeItem item , TreeItem parentItem , int index ) { } void createWidget ( ) { } Color defaultBackground ( ) { } Color defaultForeground ( ) { } public void deselectAll ( ) { } public void deselect ( TreeItem item ) { } void destroyItem ( TreeColumn column ) { } void destroyItem ( TreeItem item ) { } void fixScrollBar ( ) { } int getCheckColumnWidth ( ) { } public TreeColumn getColumn ( int index ) { } public int getColumnCount ( ) { } public int [ ] getColumnOrder ( ) { } public TreeColumn [ ] getColumns ( ) { } public int getGridLineWidth ( ) { } public int getHeaderHeight ( ) { } public boolean getHeaderVisible ( ) { } int getInsetWidth ( ) { } public TreeItem getItem ( int index ) { } public TreeItem getItem ( Point point ) { } public int getItemCount ( ) { } int getItemCount ( TreeItem item ) { } public int getItemHeight ( ) { } public TreeItem [ ] getItems ( ) { } public boolean getLinesVisible ( ) { } public TreeItem getParentItem ( ) { } public TreeItem [ ] getSelection ( ) { } public int getSelectionCount ( ) { } public TreeColumn getSortColumn ( ) { } public int getSortDirection ( ) { } public TreeItem getTopItem ( ) { } public int indexOf ( TreeColumn column ) { } public int indexOf ( TreeItem item ) { } int outlineView_child_ofItem ( int outlineView , int index , int ref ) { } int outlineView_objectValueForTableColumn_byItem ( int outlineView , int tableColumn , int ref ) { } boolean outlineView_isItemExpandable ( int outlineView , int ref ) { } int outlineView_numberOfChildrenOfItem ( int outlineView , int ref ) { } void outlineView_willDisplayCell_forTableColumn_item ( int outlineView , int cell , int tableColumn , int ref ) { } void outlineViewSelectionDidChange ( int notification ) { } boolean outlineView_shouldCollapseItem ( int outlineView , int ref ) { } boolean outlineView_shouldExpandItem ( int outlineView , int ref ) { } void outlineView_setObjectValue_forTableColumn_byItem ( int outlineView , int object , int tableColumn , int ref ) { } void releaseChildren ( boolean destroy ) { } void releaseHandle ( ) { } void releaseWidget ( ) { } public void removeAll ( ) { } public void removeSelectionListener ( SelectionListener listener ) { } public void removeTreeListener ( TreeListener listener ) { } public void setInsertMark ( TreeItem item , boolean before ) { } public void selectAll ( ) { } public void select ( TreeItem item ) { } void sendDoubleSelection ( ) { } public void setColumnOrder ( int [ ] order ) { } void setFont ( NSFont font ) { } public void setHeaderVisible ( boolean show ) { } public void setItemCount ( int count ) { } void setItemCount ( TreeItem parentItem , int count ) { int itemCount = getItemCount ( parentItem ) ; if ( count == itemCount ) return ; TreeItem [ ] children = ( parentItem == null ) ? items : parentItem . items ; if ( count < itemCount ) { for ( int index = count ; index < itemCount ; index ++ ) { TreeItem item = children [ index ] ; if ( ( item != null ) && ( ! ( item . isDisposed ( ) ) ) ) item . release ( false ) ; } } if ( count > itemCount ) { if ( ( ( getStyle ( ) ) & ( SWT . VIRTUAL ) ) == 0 ) { for ( int i = itemCount ; i < count ; i ++ ) { new TreeItem ( this , parentItem , SWT . NONE , i , true ) ; } return ; } } int length = Math . max ( 4 , ( ( ( count + 3 ) // 4 ) * 4 ) ) ; TreeItem [ ] newItems = new TreeItem [ length ] ; if ( children != null ) { <START_BUG> System . arraycopy ( items , 0 , children , 0 , Math . min ( count , itemCount ) ) ; <END_BUG> } children = newItems ; if ( parentItem == null ) { this . items = newItems ; this . itemCount = count ; } else { parentItem . items = newItems ; parentItem . itemCount = count ; } ( ( NSOutlineView ) ( view ) ) . reloadItem_ ( ( parentItem != null ? parentItem . handle : null ) ) ; } void setItemHeight ( int itemHeight ) { } void setItemHeight ( Image image ) { } public void setLinesVisible ( boolean show ) { } public void setRedraw ( boolean redraw ) { } boolean setScrollWidth ( TreeItem item ) { } boolean setScrollWidth ( boolean set ) { } boolean setScrollWidth ( boolean set , int [ ] childIds , boolean recurse ) { } public void setSelection ( TreeItem item ) { } public void setSelection ( TreeItem [ ] items ) { } public void setSortColumn ( TreeColumn column ) { } public void setSortDirection ( int direction ) { } public void setTopItem ( TreeItem item ) { } public void showColumn ( TreeColumn column ) { } public void showItem ( TreeItem item ) { } void showItem ( TreeItem item , boolean scroll ) { } public void showSelection ( ) { } }

Fix:
System . arraycopy ( children , 0 , newItems , 0 , Math . min ( count , itemCount ) ) ;