Buggy code:
public class Tree extends Composite { TreeItem [ ] items ; TreeColumn [ ] columns ; ImageList imageList ; ImageList headerImageList ; TreeItem currentItem ; TreeColumn sortColumn ; int hwndParent ; int hwndHeader ; int hAnchor ; int hInsert ; int lastID ; int hSelect ; int hFirstIndexOf ; int hLastIndexOf ; int lastIndexOf ; int itemCount ; int sortDirection ; boolean dragStarted ; boolean gestureCompleted ; boolean insertAfter ; boolean shrink ; boolean ignoreShrink ; boolean ignoreSelect ; boolean ignoreExpand ; boolean ignoreDeselect ; boolean ignoreResize ; boolean lockSelection ; boolean oldSelected ; boolean newSelected ; boolean ignoreColumnMove ; boolean linesVisible ; boolean customDraw ; boolean printClient ; boolean painted ; boolean ignoreItemHeight ; boolean ignoreCustomDraw ; boolean ignoreDrawForeground ; boolean ignoreDrawBackground ; boolean ignoreDrawFocus ; boolean ignoreDrawSelection ; boolean ignoreDrawHot ; boolean ignoreFullSelection ; boolean explorerTheme ; int scrollWidth ; int itemToolTipHandle ; int headerToolTipHandle ; int selectionForeground ; static final int INSET = 3 ; static final int GRID_WIDTH = 1 ; static final int SORT_WIDTH = 10 ; static final int HEADER_MARGIN = 12 ; static final int HEADER_EXTRA = 3 ; static final int INCREMENT = 5 ; static final int EXPLORER_EXTRA = 2 ; static final boolean EXPLORER_THEME = true ; static final int TreeProc ; static final TCHAR TreeClass = new TCHAR ( 0 , OS . WC_TREEVIEW , true ) ; static final int HeaderProc ; static final TCHAR HeaderClass = new TCHAR ( 0 , OS . WC_HEADER , true ) ; public Tree ( Composite parent , int style ) { } static int checkStyle ( int style ) { } void _addListener ( int eventType , Listener listener ) { super . _addListener ( eventType , listener ) ; switch ( eventType ) { case SWT . DragDetect : { if ( ( ( state ) & ( DRAG_DETECT ) ) != 0 ) { int bits = OS . GetWindowLong ( handle , GWL_STYLE ) ; bits &= ~ ( OS . TVS_DISABLEDRAGDROP ) ; OS . SetWindowLong ( handle , GWL_STYLE , bits ) ; } break ; } case SWT . MeasureItem : case SWT . EraseItem : case SWT . PaintItem : { customDraw = true ; style |= SWT . DOUBLE_BUFFERED ; OS . SendMessage ( handle , TVM_SETSCROLLTIME , 0 , 0 ) ; int bits = OS . GetWindowLong ( handle , GWL_STYLE ) ; bits |= OS . TVS_NOTOOLTIPS ; if ( eventType == ( SWT . MeasureItem ) ) bits |= OS . TVS_NOHSCROLL ; if ( ( ( style ) & ( SWT . FULL_SELECTION ) ) != 0 ) { if ( eventType != ( SWT . MeasureItem ) ) { if ( ! ( explorerTheme ) ) bits &= ~ ( OS . TVS_FULLROWSELECT ) ; } } if ( bits != ( OS . GetWindowLong ( handle , GWL_STYLE ) ) ) { OS . SetWindowLong ( handle , GWL_STYLE , bits ) ; OS . InvalidateRect ( handle , null , true ) ; int count = OS . SendMessage ( handle , TVM_GETCOUNT , 0 , 0 ) ; <START_BUG> if ( count != 0 ) { <END_BUG> if ( ! ( OS . IsWinCE ) ) OS . ShowScrollBar ( handle , SB_HORZ , false ) ; } } break ; } } } TreeItem _getItem ( int hItem ) { } TreeItem _getItem ( int hItem , int id ) { } void _setBackgroundPixel ( int newPixel ) { } public void addSelectionListener ( SelectionListener listener ) { } public void addTreeListener ( TreeListener listener ) { } int borderHandle ( ) { } LRESULT CDDS_ITEMPOSTPAINT ( NMTVCUSTOMDRAW nmcd , int wParam , int lParam ) { } LRESULT CDDS_ITEMPREPAINT ( NMTVCUSTOMDRAW nmcd , int wParam , int lParam ) { } LRESULT CDDS_POSTPAINT ( NMTVCUSTOMDRAW nmcd , int wParam , int lParam ) { } LRESULT CDDS_PREPAINT ( NMTVCUSTOMDRAW nmcd , int wParam , int lParam ) { } int callWindowProc ( int hwnd , int msg , int wParam , int lParam ) { } void checkBuffered ( ) { } boolean checkData ( TreeItem item , boolean redraw ) { } boolean checkData ( TreeItem item , int index , boolean redraw ) { } boolean checkHandle ( int hwnd ) { } boolean checkScroll ( int hItem ) { } protected void checkSubclass ( ) { } public void clear ( int index , boolean all ) { } void clear ( int hItem , TVITEM tvItem ) { } public void clearAll ( boolean all ) { } void clearAll ( int hItem , TVITEM tvItem , boolean all ) { } int CompareFunc ( int lParam1 , int lParam2 , int lParamSort ) { } public Point computeSize ( int wHint , int hHint , boolean changed ) { } void createHandle ( ) { } void createHeaderToolTips ( ) { } void createItem ( TreeColumn column , int index ) { } void createItem ( TreeItem item , int hParent , int hInsertAfter , int hItem ) { } void createItemToolTips ( ) { } void createParent ( ) { } void createWidget ( ) { } int defaultBackground ( ) { } void deregister ( ) { } void deselect ( int hItem , TVITEM tvItem , int hIgnoreItem ) { } public void deselectAll ( ) { } void destroyItem ( TreeColumn column ) { } void destroyItem ( TreeItem item , int hItem ) { } void enableDrag ( boolean enabled ) { } void enableWidget ( boolean enabled ) { } int findIndex ( int hFirstItem , int hItem ) { } Widget findItem ( int hItem ) { } int findItem ( int hFirstItem , int index ) { } TreeItem getFocusItem ( ) { } public int getGridLineWidth ( ) { } public int getHeaderHeight ( ) { } public boolean getHeaderVisible ( ) { }

Fix:
if ( ( count != 0 ) && ( ( bits & ( OS . TVS_NOHSCROLL ) ) != 0 ) ) {